LruCacheStorage class

An LRU cache implementation for storing file system entities (such as files) on disk.

This class extends LruCacheImpl and uses String as the key type and FileSystemEntity as the value type. The cache size is managed based on the total size (in bytes) of the files. Eviction is based on the last modified time of the files.

Inheritance

Constructors

LruCacheStorage.new(int maxSize)
Constructs an LruCacheStorage 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, FileSystemEntity>
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<FileSystemEntity?>
Retrieves the file associated with the given key, or null if not present or does not exist.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
put(String key, FileSystemEntity value) Future<FileSystemEntity?>
Inserts or updates the file for the given key in the cache.
override
remove(String key) Future<FileSystemEntity?>
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