Package 

Interface Memory


  • 
    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 T and the value is a File.

    • Disk-Based Storage: A persistent storage using DiskMemory for storing key-value pairs, where the key is of type T and 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 DiskMemory createDiskMemory() Creates and returns a disk-based storage mechanism for persisting data.
      abstract Integer inMemorySize() Returns the size of the in-memory cache.
      abstract Unit freeInMemory() Frees or clears the in-memory cache, releasing the resources it holds.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.