java.lang.Object | |
↳ | com.android.volley.toolbox.DiskBasedCache |
Cache implementation that caches files directly onto the hard disk in the specified directory. The default disk usage size is 5MB, but is configurable.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DiskBasedCache(File rootDirectory, int maxCacheSizeInBytes)
Constructs an instance of the DiskBasedCache at the specified directory.
| |||||||||||
DiskBasedCache(File rootDirectory)
Constructs an instance of the DiskBasedCache at the specified directory using
the default maximum cache size of 5MB.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
synchronized void |
clear()
Clears the cache.
| ||||||||||
synchronized 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.
| ||||||||||
synchronized void |
initialize()
Initializes the DiskBasedCache by scanning for all files currently in the
specified root directory.
| ||||||||||
synchronized void |
invalidate(String key, boolean fullExpire)
Invalidates an entry in the cache.
| ||||||||||
synchronized void |
put(String key, Cache.Entry entry)
Puts the entry with the specified key into the cache.
| ||||||||||
synchronized void |
remove(String key)
Removes the specified key from the cache if it exists.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.android.volley.Cache
|
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. |
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. |
---|
Clears the cache. Deletes all cached files from disk.
Returns the cache entry with the specified key if it exists, null otherwise.
key | Cache key |
---|
Cache.Entry
or null in the event of a cache miss
Returns a file object for the given cache key.
Initializes the DiskBasedCache by scanning for all files currently in the specified root directory. Creates the root directory if necessary.
Invalidates an entry in the cache.
key | Cache key |
---|---|
fullExpire | True to fully expire the entry, false to soft expire |
Puts the entry with the specified key into the cache.
key | Cache key |
---|---|
entry | Data to store and metadata for cache coherency, TTL, etc. |
Removes the specified key from the cache if it exists.
key | Cache key |
---|