LruCacheSingleton class

A singleton class that manages both in-memory and disk-based LRU caches.

This class provides a unified interface for caching binary data in memory and files on disk. It ensures thread safety and lazy initialization for the storage cache. The cache sizes are configurable via the Config class.

Constructors

LruCacheSingleton.new()
Factory constructor to return the singleton instance.
factory

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

memoryClear() Future<void>
Clears all entries from the in-memory cache.
memoryFormatSize() Future<String>
Returns the formatted size of the in-memory cache.
memoryGet(String key) Future<Uint8List?>
Retrieves a value from the in-memory cache by key.
memoryPut(String key, Uint8List value) Future<Uint8List?>
Inserts a value into the in-memory cache.
memoryRemove(String key) Future<void>
Removes a value from the in-memory cache by key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeCacheByUrl(String url, {bool singleFile = false}) Future<void>
Removes cache entries (both in-memory and disk) associated with a URL.
storageClear() Future<void>
Clears all entries from the disk cache and deletes all files in the cache directory.
storageClearByDirPath(String dirPath) Future<void>
Clears all files in a specific directory path from the disk cache.
storageFormatSize() Future<String>
Returns the formatted size of the disk cache.
storageGet(String key) Future<Uint8List?>
Retrieves a value from the disk cache by key as bytes.
storageMap() LinkedHashMap<String, FileSystemEntity>
Returns the internal map of the disk cache.
storagePut(String key, File value) Future<void>
Inserts a file into the disk cache.
storageRemove(String key) Future<void>
Removes a file from the disk cache by key.
storageSizeInBytes() Future<int>
Returns the size of the disk cache.
toString() String
A string representation of this object.
inherited

Operators

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