Class Overview
HttpCacheStorage
implementation capable of deallocating resources associated with
the cache entries. This cache keeps track of cache entries using PhantomReference
and maintains a collection of all resources that are no longer in use. The cache, however,
does not automatically deallocates associated resources by invoking dispose()
method. The consumer MUST periodically call cleanResources()
method to trigger
resource deallocation. The cache can be permanently shut down using shutdown()
method. All resources associated with the entries used by the cache will be deallocated.
This HttpCacheStorage
implementation is intended for use with FileResource
and similar.
Public Constructors
Public Methods
public
void
cleanResources
()
Retrieves the cache entry stored under the given key
or null if no entry exists under that key.
Store a given cache entry under the given key.
Parameters
url
| where in the cache to store the entry |
entry
| cached response to store |
public
void
removeEntry
(String url)
Deletes/invalidates/removes any cache entries currently
stored under the given key.
Atomically applies the given callback to update an existing cache
entry under a given key.
Parameters
url
| indicates which entry to modify |
callback
| performs the update; see
HttpCacheUpdateCallback for details, but roughly the
callback expects to be handed the current entry and will return
the new value for the entry. |