Cache.Entry| 构造器和说明 |
|---|
DiskBasedCache(File rootDirectory)
Constructs an instance of the DiskBasedCache at the specified directory using
the default maximum cache size of 5MB.
|
DiskBasedCache(File rootDirectory,
int maxCacheSizeInBytes)
Constructs an instance of the DiskBasedCache at the specified directory.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
Clears the cache.
|
Cache.Entry |
get(String key)
Returns the cache entry with the specified key if it exists, null otherwise.
|
File |
getFileForKey(String key)
Returns a file object for the given cache key.
|
void |
initialize()
Initializes the DiskBasedCache by scanning for all files currently in the
specified root directory.
|
void |
invalidate(String key,
boolean fullExpire)
Invalidates an entry in the cache.
|
void |
put(String key,
Cache.Entry entry)
Puts the entry with the specified key into the cache.
|
void |
remove(String key)
Removes the specified key from the cache if it exists.
|
public DiskBasedCache(File rootDirectory, int maxCacheSizeInBytes)
rootDirectory - The root directory of the cache.maxCacheSizeInBytes - The maximum size of the cache in bytes.public DiskBasedCache(File rootDirectory)
rootDirectory - The root directory of the cache.public void clear()
public Cache.Entry get(String key)
get 在接口中 Cachekey - Cache keyCache.Entry or null in the event of a cache misspublic void initialize()
initialize 在接口中 Cachepublic void invalidate(String key, boolean fullExpire)
invalidate 在接口中 Cachekey - Cache keyfullExpire - True to fully expire the entry, false to soft expirepublic void put(String key, Cache.Entry entry)
public void remove(String key)
Copyright © 2018. All rights reserved.