LruCacheMemory class
An in-memory implementation of an LRU cache for storing binary data.
This class extends LruCacheImpl and uses String as the key type and Uint8List as the value type for storing binary resources of files. The cache size is managed based on the total number of bytes stored.
Constructors
- LruCacheMemory.new(int maxSize)
-
Constructs an LruCacheMemory with the specified
maxSize
in bytes.
Properties
- evictionCount ↔ int
-
The total number of times an entry has been evicted from the cache.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hitCount ↔ int
-
The total number of cache hits (successful lookups).
getter/setter pairinherited
- lock → Lock
-
A lock used to synchronize access to the cache for thread safety.
finalinherited
-
map
↔ LinkedHashMap<
String, Uint8List> -
The map that stores the cache entries in access order.
latefinalinherited
- maxSize ↔ int
-
The maximum number of entries the cache can hold.
getter/setter pairinherited
- missCount ↔ int
-
The total number of cache misses (failed lookups).
getter/setter pairinherited
- putCount ↔ int
-
The total number of times an entry has been added to the cache.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size ↔ int
-
The current number of entries in the cache.
getter/setter pairinherited
Methods
-
clear(
) → Future< void> -
Removes all entries from the cache.
inherited
-
get(
String key) → Future< Uint8List?> -
Retrieves the value associated with the given
key
, ornull
if not present.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
put(
String key, Uint8List value) → Future< Uint8List?> -
Inserts or updates the value for the given
key
in the cache.override -
remove(
String key) → Future< Uint8List?> -
Removes the entry for the specified
key
from the cache, if it exists.override -
resize(
int maxSize) → Future< void> -
Resizes the cache to the new
maxSize
.inherited -
toString(
) → String -
Returns a string representation of the cache, including statistics such as
maximum size, hit count, miss count, and hit rate percentage.
inherited
-
trimToSize(
int maxSize) → Future< void> -
Trims the cache so that its total size does not exceed
maxSize
bytes.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited