-
public interface Memory<T extends Object>An interface for managing data storage, both in-memory and on disk.
Implementations of this interface provide methods for creating and interacting with:
In-Memory Cache: A temporary storage using InMemoryLruCache for caching key-value pairs, where the key is of type
Tand the value is a File.Disk-Based Storage: A persistent storage using DiskMemory for storing key-value pairs, where the key is of type
Tand the value is a File.
-
-
Method Summary
Modifier and Type Method Description abstract InMemoryLruCache<Pair<T, File>>createInMemory()Creates and returns an in-memory LRU (Least Recently Used) cache. abstract DiskMemorycreateDiskMemory()Creates and returns a disk-based storage mechanism for persisting data. abstract IntegerinMemorySize()Returns the size of the in-memory cache. abstract UnitfreeInMemory()Frees or clears the in-memory cache, releasing the resources it holds. -
-
Method Detail
-
createInMemory
abstract InMemoryLruCache<Pair<T, File>> createInMemory()
Creates and returns an in-memory LRU (Least Recently Used) cache.
This cache is used for temporary storage of key-value pairs, providing fast access to recently used data.
-
createDiskMemory
abstract DiskMemory createDiskMemory()
Creates and returns a disk-based storage mechanism for persisting data.
This storage is used for permanent storage of key-value pairs, ensuring data is preserved across app sessions.
-
inMemorySize
abstract Integer inMemorySize()
Returns the size of the in-memory cache.
The meaning of "size" may vary depending on the specific implementation of InMemoryLruCache. It could represent the number of entries or the total memory consumed.
-
freeInMemory
abstract Unit freeInMemory()
Frees or clears the in-memory cache, releasing the resources it holds.
This is typically used to reclaim memory when it is no longer needed.
-
-
-
-