Back to Fresco

FileCache

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

3.6.016.5 KB
Original Source

Fresco

|

|

Packages | Classes

Interfaces

Classes

Annotations

Packages | Classes

Summary: Methods | Inherited Methods | [Expand All]

public interface

FileCache

implements DiskTrimmable

| com.facebook.cache.disk.FileCache |

| Known Indirect Subclasses

DiskStorageCache

| DiskStorageCache | Cache that manages disk storage. |

|

Class Overview

Interface that caches based on disk should implement.

Summary

Public Methods
abstract void
abstract long
Deletes old cache files.
abstract long
abstract DiskStorage.DiskDumpInfo
abstract BinaryResource
Returns the binary resource cached with key.
abstract long
abstract boolean
abstract boolean
Returns true if the key is in the in-memory key index.
abstract BinaryResource
Inserts resource into file with key
abstract boolean
Tells if this cache is enabled.
abstract boolean
abstract void
Removes a resource by key from cache.

| [Expand] Inherited Methods | | --- | | From interface com.facebook.common.disk.DiskTrimmable

| abstract void | trimToMinimum() Called when there is very little disk space left. | | abstract void | trimToNothing() Called when there is almost no disk space left and the app is likely to crash soon |

|

Public Methods

public abstract void clearAll()

public abstract long clearOldEntries(long cacheExpirationMs)

Deletes old cache files.

Parameters

| cacheExpirationMs | files older than this will be deleted. |

Returns
  • the age in ms of the oldest file remaining in the cache.

public abstract long getCount()

Returns
  • the count of pictures in the cache

public abstract DiskStorage.DiskDumpInfo getDumpInfo()

Throws

| IOException | |

public abstract BinaryResource getResource(CacheKey key)

Returns the binary resource cached with key.

public abstract long getSize()

Returns
  • the in-use size of the cache

public abstract boolean hasKey(CacheKey key)

public abstract boolean hasKeySync(CacheKey key)

Returns true if the key is in the in-memory key index.

Not guaranteed to be correct. The cache may yet have this key even if this returns false. But if it returns true, it definitely has it.

Avoids a disk read.

public abstract BinaryResource insert(CacheKey key, WriterCallback writer)

Inserts resource into file with key

Parameters

| key | cache key | | writer | Callback that writes to an output stream |

Returns
  • a sequence of bytes
Throws

| IOException | |

public abstract boolean isEnabled()

Tells if this cache is enabled. It's important for some caches that can be disabled without further notice (like in removable/unmountable storage). Anyway a disabled cache should just ignore calls, not fail.

Returns
  • true if this cache is usable, false otherwise.

public abstract boolean probe(CacheKey key)

public abstract void remove(CacheKey key)

Removes a resource by key from cache.

Parameters

| key | cache key |

+Generated by Doclava. +