Back to Fresco

DiskStorage

docs/javadoc/reference/com/facebook/cache/disk/DiskStorage.html

3.6.017.8 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Annotations

Packages | Classes

Summary: Nested Classes | Methods | [Expand All]

public interface

DiskStorage

| com.facebook.cache.disk.DiskStorage |

| Known Indirect Subclasses

DefaultDiskStorage, DynamicDefaultDiskStorage

| DefaultDiskStorage | The default disk storage implementation. | | DynamicDefaultDiskStorage | A supplier of a DiskStorage concrete implementation. |

|

Class Overview

Storage for files in the cache. Responsible for maintaining state (count, size, watch file existence, reachability)

Summary

Nested Classes
class
class
interface
interface
Public Methods
abstract void
Clear all contents of the storage
abstract boolean
Does a resource with this name exist?
abstract DiskStorage.DiskDumpInfo
abstract Collection<DiskStorage.Entry>
Get all entries currently in the storage
abstract BinaryResource
Get the resource with the specified name
abstract String
Get the storage's name, which should be unique
abstract DiskStorage.Inserter
Creates a temporary resource for writing content.
abstract boolean
is this storage enabled?
abstract boolean
is this storage external?
abstract void
abstract long
Remove the resource represented by the entry
abstract long
Remove the resource with specified id
abstract boolean
Does a resource with this name exist? If so, update the last-accessed time for the resource

Public Methods

public abstract void clearAll()

Clear all contents of the storage

Throws

| | IOException | | IOException | |

public abstract boolean contains(String resourceId, Object debugInfo)

Does a resource with this name exist?

Parameters

| resourceId | id of the resource | | debugInfo | helper object for debugging |

Returns
  • true, if the resource is present in the storage, false otherwise
Throws

| IOException | |

public abstract DiskStorage.DiskDumpInfo getDumpInfo()

Throws

| IOException | |

public abstract Collection<DiskStorage.Entry> getEntries()

Get all entries currently in the storage

Returns
  • a collection of entries in storage
Throws

| IOException | |

public abstract BinaryResource getResource(String resourceId, Object debugInfo)

Get the resource with the specified name

Parameters

| resourceId | id of the resource | | debugInfo | helper object for debugging |

Returns
  • the resource with the specified name. NULL if not found
Throws

| IOException | for unexpected behavior. |

public abstract String getStorageName()

Get the storage's name, which should be unique

Returns
  • name of the this storage

public abstract DiskStorage.Inserter insert(String resourceId, Object debugInfo)

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

Parameters

| resourceId | id of the resource | | debugInfo | helper object for debugging |

Returns
  • the Inserter object with methods to write data, commit or cancel the insertion
Throws

| IOException | on errors during this operation |

public abstract boolean isEnabled()

is this storage enabled?

Returns
  • true, if enabled

public abstract boolean isExternal()

is this storage external?

Returns
  • true, if external

public abstract void purgeUnexpectedResources()

public abstract long remove(DiskStorage.Entry entry)

Remove the resource represented by the entry

Parameters

| entry | entry of the resource to delete |

Returns
  • size of deleted file if successfully deleted, -1 otherwise
Throws

| IOException | |

public abstract long remove(String resourceId)

Remove the resource with specified id

Returns
  • size of deleted file if successfully deleted, -1 otherwise
Throws

| IOException | |

public abstract 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 |

Returns
  • true, if the resource is present in the storage, false otherwise
Throws

| IOException | |

+Generated by Doclava. +