Package 

Class DiskLruCacheWrapper

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

    
    public class DiskLruCacheWrapper
     implements DiskCache
                        

    The default DiskCache implementation. There must be no more than one active instance for a given directory at a time.

    • Method Summary

      Modifier and Type Method Description
      static synchronized DiskCache get(File directory, long maxSize) Get a DiskCache in the given directory and size.
      static DiskCache create(File directory, long maxSize) Create a new DiskCache in the given directory with a specified max size.
      File get(Key key) Get the cache for the value at the given key.
      void put(Key key, DiskCache.Writer writer) Write to a key in the cache.
      void delete(Key key) Remove the key and value from the cache.
      synchronized void clear() Clear the cache.
      • Methods inherited from class java.lang.Object

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

      • get

        @Deprecated() static synchronized DiskCache get(File directory, long maxSize)

        Get a DiskCache in the given directory and size. If a disk cache has already been created witha different directory and/or size, it will be returned instead and the new arguments will beignored.

        Parameters:
        directory - The directory for the disk cache
        maxSize - The max size for the disk cache
      • create

         static DiskCache create(File directory, long maxSize)

        Create a new DiskCache in the given directory with a specified max size.

        Parameters:
        directory - The directory for the disk cache
        maxSize - The max size for the disk cache
      • get

         File get(Key key)

        Get the cache for the value at the given key.

        Note - This is potentially dangerous, someone may write a new value to the file at any pointin time and we won't know about it.

        Parameters:
        key - The key in the cache.
      • put

         void put(Key key, DiskCache.Writer writer)

        Write to a key in the cache. Writer is used so that the cache implementation canperform actions after the write finishes, like commit (via atomic file rename).

        Parameters:
        key - The key to write to.
        writer - An interface that will write data given an OutputStream for the key.
      • delete

         void delete(Key key)

        Remove the key and value from the cache.

        Parameters:
        key - The key to remove.
      • clear

         synchronized void clear()

        Clear the cache.