Skip to content

A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

SF-Zhou/lockmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lockmap

Rust codecov Crates.io Documentation

A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level.

Usage

use lockmap::LockMap;

// Create a new lock map
let map = LockMap::<String, String>::new();

// Set a value
map.insert_by_ref("key", "value".into());

// Get a value
assert_eq!(map.get("key"), Some("value".into()));

// Use entry API for exclusive access
{
    let mut entry = map.entry_by_ref("key");
    assert_eq!(entry.get().as_deref(), Some("value"));
    entry.insert("new value".to_string());
}

// Remove a value
assert_eq!(map.remove("key"), Some("new value".into()));

About

A high-performance, thread-safe HashMap implementation for Rust that provides fine-grained locking at the key level.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages