接口 Cache
- 所有已知实现类:
DiskBasedCache,NoCache
public interface Cache
An interface for a cache keyed by a String with a byte array as data.
-
嵌套类概要
嵌套类 -
方法概要
修饰符和类型方法说明voidclear()Empties the cache.Retrieves an entry from the cache.voidPerforms any potentially long-running actions needed to initialize the cache; will be called from a worker thread.voidinvalidate(String key, boolean fullExpire) Invalidates an entry in the cache.voidput(String key, Cache.Entry entry) Adds or replaces an entry to the cache.voidRemoves an entry from the cache.
-
方法详细资料
-
get
Retrieves an entry from the cache.- 参数:
key- Cache key- 返回:
- An
Cache.Entryor null in the event of a cache miss
-
put
Adds or replaces an entry to the cache.- 参数:
key- Cache keyentry- Data to store and metadata for cache coherency, TTL, etc.
-
initialize
void initialize()Performs any potentially long-running actions needed to initialize the cache; will be called from a worker thread. -
invalidate
Invalidates an entry in the cache.- 参数:
key- Cache keyfullExpire- True to fully expire the entry, false to soft expire
-
remove
Removes an entry from the cache.- 参数:
key- Cache key
-
clear
void clear()Empties the cache.
-