LruCache<K, V> class abstract

An abstract class that defines the contract for a Least Recently Used (LRU) cache.

This cache stores key-value pairs and evicts the least recently accessed items when the cache exceeds its maximum size. The interface is asynchronous, allowing for implementations that may involve I/O operations (e.g., disk or network).

Type Parameters:

  • K: The type of keys maintained by this cache.
  • V: The type of mapped values.
Implementers

Constructors

LruCache.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() Future<void>
Removes all entries from the cache.
get(K key) Future<V?>
Returns the value associated with the given key, or null if the key is not present.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(K key, V value) Future<V?>
Inserts or updates the value for the given key in the cache.
remove(K key) Future<V?>
Removes the entry for the specified key from the cache, if it exists.
resize(int maxSize) Future<void>
Resizes the cache to the new maxSize.
toString() String
A string representation of this object.
inherited
trimToSize(int maxSize) Future<void>
Trims the cache so that its size does not exceed maxSize.

Operators

operator ==(Object other) bool
The equality operator.
inherited