Package 

Class DefaultDiskStorage

  • All Implemented Interfaces:
    com.facebook.cache.disk.DiskStorage

    
    public class DefaultDiskStorage
     implements DiskStorage
                        

    The default disk storage implementation. Subsumes both 'simple' and 'sharded' implementations via a new SubdirectorySupplier.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public @interface DefaultDiskStorage.FileType

      Categories for the different internal files a ShardedDiskStorage maintains. CONTENT: the filethat has the content TEMP: temporal files, used to write the content until they are switched toCONTENT files

    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultDiskStorage(File rootDirectory, int version, CacheErrorLogger cacheErrorLogger) Instantiates a ShardedDiskStorage that will use the directory to save a map between keys andfiles.
    • Constructor Detail

      • DefaultDiskStorage

        DefaultDiskStorage(File rootDirectory, int version, CacheErrorLogger cacheErrorLogger)
        Instantiates a ShardedDiskStorage that will use the directory to save a map between keys andfiles.
        Parameters:
        rootDirectory - root directory to create all content under
        version - version of the format used in the files.
        cacheErrorLogger - logger for various events
    • Method Detail

      • isEnabled

         boolean isEnabled()

        is this storage enabled?

      • isExternal

         boolean isExternal()

        is this storage external?

      • insert

         DiskStorage.Inserter insert(String resourceId, Object debugInfo)

        Creates a temporary resource for writing content. Split from commit() in order to allowconcurrent writing of cache entries. This entry will not be available to cache clients untilcommit() is called passing in the resource returned from this method.

        Parameters:
        resourceId - id of the resource
        debugInfo - helper object for debugging
      • contains

         boolean contains(String resourceId, Object debugInfo)

        Does a resource with this name exist?

        Parameters:
        resourceId - id of the resource
        debugInfo - helper object for debugging
      • touch

         boolean touch(String resourceId, Object debugInfo)

        Does a resource with this name exist? If so, update the last-accessed time for the resource

        Parameters:
        resourceId - id of the resource
        debugInfo - helper object for debugging
      • remove

         long remove(DiskStorage.Entry entry)

        Remove the resource represented by the entry

        Parameters:
        entry - entry of the resource to delete
      • remove

         long remove(String resourceId)

        Remove the resource with specified id

      • clearAll

         void clearAll()

        Clear all contents of the storage