Class LRUCache<K, V>
A least recently used cache implemetation.
Inherited Members
Namespace: Advanced.Algorithms.Distributed
Assembly: Advanced.Algorithms.dll
Syntax
public class LRUCache<K, V>
Type Parameters
| Name | Description |
|---|---|
| K | |
| V |
Constructors
LRUCache(Int32)
Declaration
public LRUCache(int capacity)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | capacity |
Methods
Get(K)
Time complexity: O(1).
Declaration
public V Get(K key)
Parameters
| Type | Name | Description |
|---|---|---|
| K | key |
Returns
| Type | Description |
|---|---|
| V |
Put(K, V)
Time complexity: O(1).
Declaration
public void Put(K key, V value)
Parameters
| Type | Name | Description |
|---|---|---|
| K | key | |
| V | value |