-
- All Implemented Interfaces:
-
com.facebook.cache.disk.DiskStorage
public class DynamicDefaultDiskStorage implements DiskStorage
A supplier of a DiskStorage concrete implementation.
-
-
Constructor Summary
Constructors Constructor Description DynamicDefaultDiskStorage(int version, Supplier<File> baseDirectoryPathSupplier, String baseDirectoryName, CacheErrorLogger cacheErrorLogger)
-
Method Summary
Modifier and Type Method Description booleanisEnabled()is this storage enabled? booleanisExternal()is this storage external? StringgetStorageName()Get the storage's name, which should be unique BinaryResourcegetResource(String resourceId, Object debugInfo)Get the resource with the specified name booleancontains(String resourceId, Object debugInfo)Does a resource with this name exist? booleantouch(String resourceId, Object debugInfo)Does a resource with this name exist? voidpurgeUnexpectedResources()DiskStorage.Inserterinsert(String resourceId, Object debugInfo)Creates a temporary resource for writing content. Collection<DiskStorage.Entry>getEntries()Get all entries currently in the storage longremove(DiskStorage.Entry entry)Remove the resource represented by the entry longremove(String resourceId)Remove the resource with specified id voidclearAll()Clear all contents of the storage DiskStorage.DiskDumpInfogetDumpInfo()-
-
Constructor Detail
-
DynamicDefaultDiskStorage
DynamicDefaultDiskStorage(int version, Supplier<File> baseDirectoryPathSupplier, String baseDirectoryName, CacheErrorLogger cacheErrorLogger)
-
-
Method Detail
-
isEnabled
boolean isEnabled()
is this storage enabled?
-
isExternal
boolean isExternal()
is this storage external?
-
getStorageName
String getStorageName()
Get the storage's name, which should be unique
-
getResource
@Nullable() BinaryResource getResource(String resourceId, Object debugInfo)
Get the resource with the specified name
- Parameters:
resourceId- id of the resourcedebugInfo- helper object for debugging
-
contains
boolean contains(String resourceId, Object debugInfo)
Does a resource with this name exist?
- Parameters:
resourceId- id of the resourcedebugInfo- 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 resourcedebugInfo- helper object for debugging
-
purgeUnexpectedResources
void purgeUnexpectedResources()
-
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 resourcedebugInfo- helper object for debugging
-
getEntries
Collection<DiskStorage.Entry> getEntries()
Get all entries currently in the storage
-
remove
long remove(DiskStorage.Entry entry)
Remove the resource represented by the entry
- Parameters:
entry- entry of the resource to delete
-
clearAll
void clearAll()
Clear all contents of the storage
-
getDumpInfo
DiskStorage.DiskDumpInfo getDumpInfo()
-
-
-
-