Package 

Class MemoryCacheAdapter

  • All Implemented Interfaces:
    com.mobwith.imgmodule.load.engine.cache.MemoryCache

    
    public class MemoryCacheAdapter
     implements MemoryCache
                        

    A simple class that ignores all puts and returns null for all gets.

    • Method Summary

      Modifier and Type Method Description
      long getCurrentSize() Returns the sum of the sizes of all the contents of the cache in bytes.
      long getMaxSize() Returns the current maximum size in bytes of the cache.
      void setSizeMultiplier(float multiplier) Adjust the maximum size of the cache by multiplying the original size of the cache by the givenmultiplier.
      Resource<out Object> remove(@NonNull() Key key) Removes the value for the given key and returns it if present or null otherwise.
      Resource<out Object> put(@NonNull() Key key, @Nullable() Resource<out Object> resource) Add bitmap to the cache with the given key.
      void setResourceRemovedListener(@NonNull() MemoryCache.ResourceRemovedListener listener) Set the listener to be called when a bitmap is removed from the cache.
      void clearMemory() Evict all items from the memory cache.
      void trimMemory(int level) Trim the memory cache to the appropriate level.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getCurrentSize

         long getCurrentSize()

        Returns the sum of the sizes of all the contents of the cache in bytes.

      • getMaxSize

         long getMaxSize()

        Returns the current maximum size in bytes of the cache.

      • setSizeMultiplier

         void setSizeMultiplier(float multiplier)

        Adjust the maximum size of the cache by multiplying the original size of the cache by the givenmultiplier.

        If the size multiplier causes the size of the cache to be decreased, items will be evicteduntil the cache is smaller than the new size.

        Parameters:
        multiplier - A size multiplier >= 0.
      • clearMemory

         void clearMemory()

        Evict all items from the memory cache.

      • trimMemory

         void trimMemory(int level)

        Trim the memory cache to the appropriate level. Typically called on the callback onTrimMemory.

        Parameters:
        level - This integer represents a trim level as specified in .