Thread-safe LRU (Least Recently Used) cache implementation. Provides O(1) get and put operations with automatic eviction when capacity is exceeded.
More...
|
| | LRUCache (int capacity) |
| bool | TryGet (TKey key, out TValue? value) |
| | Gets the value associated with the specified key.
|
| void | Add (TKey key, TValue value) |
| | Adds or updates a value in the cache.
|
| bool | Remove (TKey key) |
| | Removes the value with the specified key from the cache.
|
| void | Clear () |
| | Removes all items from the cache.
|
| | CacheItem (TKey key, TValue value) |
|
| int | Count [get] |
| | Gets the number of items currently in the cache.
|
| TKey | Key [get] |
| TValue | Value [get, set] |
Thread-safe LRU (Least Recently Used) cache implementation. Provides O(1) get and put operations with automatic eviction when capacity is exceeded.
◆ Add()
| void livemap.util.LRUCache< TKey, TValue >.Add |
( |
TKey | key, |
|
|
TValue | value ) |
|
inline |
Adds or updates a value in the cache.
- Parameters
-
| key | The key of the value to add or update. |
| value | The value to add or update. |
◆ CacheItem()
| livemap.util.LRUCache< TKey, TValue >.CacheItem |
( |
TKey | key, |
|
|
TValue | value ) |
|
inline |
◆ Clear()
| void livemap.util.LRUCache< TKey, TValue >.Clear |
( |
| ) |
|
|
inline |
Removes all items from the cache.
◆ LRUCache()
| livemap.util.LRUCache< TKey, TValue >.LRUCache |
( |
int | capacity | ) |
|
|
inline |
◆ Remove()
| bool livemap.util.LRUCache< TKey, TValue >.Remove |
( |
TKey | key | ) |
|
|
inline |
Removes the value with the specified key from the cache.
- Parameters
-
| key | The key of the value to remove. |
- Returns
- true if the element was successfully removed; otherwise, false.
◆ TryGet()
| bool livemap.util.LRUCache< TKey, TValue >.TryGet |
( |
TKey | key, |
|
|
out TValue? | value ) |
|
inline |
Gets the value associated with the specified key.
- Parameters
-
| key | The key of the value to get. |
| value | When this method returns, contains the value associated with the specified key, if found; otherwise, the default value. |
- Returns
- true if the cache contains an element with the specified key; otherwise, false.
◆ Count
| int livemap.util.LRUCache< TKey, TValue >.Count |
|
get |
Gets the number of items currently in the cache.
◆ Key
| TKey livemap.util.LRUCache< TKey, TValue >.Key |
|
get |
◆ Value
| TValue livemap.util.LRUCache< TKey, TValue >.Value |
|
getset |
The documentation for this class was generated from the following file: