Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/a-agmon/LocalLRU
/ functions
Functions
20 in github.com/a-agmon/LocalLRU
⨍
Functions
20
◇
Types & classes
5
↓ 13 callers
Method
add_item
Adds an item to the cache. # Arguments `key` - The key to add the item for. `value` - The value to add to the cache represented as `Bytes`.
src/lib.rs:99
↓ 3 callers
Method
get_item
Gets an item from the cache. In LRU cache fetching, the item is moved to the front of the list. # Returns An Option containing the item if it exists,
src/lib.rs:82
↓ 3 callers
Method
move_to_head
Moves the given node to the front of the list. This function is called when the item is accessed.
src/cache.rs:94
↓ 3 callers
Method
remove_node
Removes the given node from the list.
src/cache.rs:101
↓ 2 callers
Method
add_to_head
Adds the given node to the front of the list.
src/cache.rs:128
↓ 2 callers
Method
get_struct
Wrapper function to get a struct from the cache. It uses bincode to deserialize the Bytes object back into a struct. # Arguments `key` - The key to g
src/lib.rs:129
↓ 2 callers
Method
initialize_cache_if_none
(&self)
src/lib.rs:70
↓ 1 callers
Method
add_struct
Wrapper function to add a struct to the cache. It simple uses bincode to serialize the struct and add it to the cache as a Bytes object. # Arguments
src/lib.rs:115
↓ 1 callers
Method
create_node
(&self, key: String, value: Bytes)
src/cache.rs:142
Method
add_item
Adds an item to the cache. If the item already exists, it updates the value and moves it to the front. If adding the new item exceeds the capacity, it
src/cache.rs:43
Method
get_item
Retrieves an item from the cache by key. If the item exists, it moves it to the front.
src/cache.rs:67
Method
initialize
Initilizalizes a new LocalCache with the given capacity and ttl. Note that this only initializes the parameters that set the cache capacity and ttl. T
src/lib.rs:61
Method
new
(capacity: usize, ttl: u64)
src/lib.rs:66
Method
new
(capacity: usize, ttl_seconds: u64)
src/cache.rs:31
Function
test_add_and_get_struct
()
src/lib.rs:215
Function
test_capacity_based_eviction
()
src/lib.rs:144
Function
test_get_item_updates_order
()
src/lib.rs:165
Function
test_no_ttl_expiration
()
src/lib.rs:200
Function
test_thread_local_isolation
()
src/lib.rs:244
Function
test_ttl_expiration
()
src/lib.rs:185