类 DiskBasedCache
java.lang.Object
com.android.volley.toolbox.DiskBasedCache
- 所有已实现的接口:
Cache
Cache implementation that caches files directly onto the hard disk in the specified
directory. The default disk usage size is 5MB, but is configurable.
-
嵌套类概要
从接口继承的嵌套类/接口 com.android.volley.Cache
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. -
方法概要
修饰符和类型方法说明voidclear()Clears the cache.Returns the cache entry with the specified key if it exists, null otherwise.getFileForKey(String key) Returns a file object for the given cache key.voidInitializes the DiskBasedCache by scanning for all files currently in the specified root directory.voidinvalidate(String key, boolean fullExpire) Invalidates an entry in the cache.voidput(String key, Cache.Entry entry) Puts the entry with the specified key into the cache.voidRemoves the specified key from the cache if it exists.
-
构造器详细资料
-
DiskBasedCache
Constructs an instance of the DiskBasedCache at the specified directory.- 参数:
rootDirectory- The root directory of the cache.maxCacheSizeInBytes- The maximum size of the cache in bytes.
-
DiskBasedCache
Constructs an instance of the DiskBasedCache at the specified directory using the default maximum cache size of 5MB.- 参数:
rootDirectory- The root directory of the cache.
-
-
方法详细资料
-
clear
public void clear()Clears the cache. Deletes all cached files from disk. -
get
Returns the cache entry with the specified key if it exists, null otherwise.- 指定者:
get在接口中Cache- 参数:
key- Cache key- 返回:
- An
Cache.Entryor null in the event of a cache miss
-
initialize
public void initialize()Initializes the DiskBasedCache by scanning for all files currently in the specified root directory. Creates the root directory if necessary.- 指定者:
initialize在接口中Cache
-
invalidate
Invalidates an entry in the cache.- 指定者:
invalidate在接口中Cache- 参数:
key- Cache keyfullExpire- True to fully expire the entry, false to soft expire
-
put
Puts the entry with the specified key into the cache. -
remove
Removes the specified key from the cache if it exists. -
getFileForKey
Returns a file object for the given cache key.
-