Class Overview
Basic HttpCacheStorage
implementation backed by an instance of
LinkedHashMap. In other words, cache entries and the cached
response bodies are held in-memory. This cache does NOT deallocate
resources associated with the cache entries; it is intended for use
with HeapResource
and similar. This is the default cache
storage backend used by CachingHttpClient
.
Public Constructors
Public Methods
Gets an entry from the cache, if it exists
Parameters
url
| Url that is the cache key |
Returns
- HttpCacheEntry if one exists, or null for cache miss
public
synchronized
void
putEntry
(String url, HttpCacheEntry entry)
Places a HttpCacheEntry in the cache
Parameters
url
| Url to use as the cache key |
entry
| HttpCacheEntry to place in the cache
|
public
synchronized
void
removeEntry
(String url)
Removes a HttpCacheEntry from the cache
Parameters
url
| Url that is the cache 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. |