Package org.apache.http.client.cache
Interface HttpCacheStorage
-
- All Known Implementing Classes:
BasicHttpCacheStorage,EhcacheHttpCacheStorage,ManagedHttpCacheStorage,MemcachedHttpCacheStorage
public interface HttpCacheStorageNew storage backends should implement thisHttpCacheStorageinterface. They can then be plugged into the existingCachingHttpClientimplementation.- Since:
- 4.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpCacheEntrygetEntry(java.lang.String key)Retrieves the cache entry stored under the given key or null if no entry exists under that key.voidputEntry(java.lang.String key, HttpCacheEntry entry)Store a given cache entry under the given key.voidremoveEntry(java.lang.String key)Deletes/invalidates/removes any cache entries currently stored under the given key.voidupdateEntry(java.lang.String key, HttpCacheUpdateCallback callback)Atomically applies the given callback to update an existing cache entry under a given key.
-
-
-
Method Detail
-
putEntry
void putEntry(java.lang.String key, HttpCacheEntry entry) throws java.io.IOExceptionStore a given cache entry under the given key.- Parameters:
key- where in the cache to store the entryentry- cached response to store- Throws:
java.io.IOException
-
getEntry
HttpCacheEntry getEntry(java.lang.String key) throws java.io.IOException
Retrieves the cache entry stored under the given key or null if no entry exists under that key.- Parameters:
key- cache key- Returns:
- an
HttpCacheEntryornullif no entry exists - Throws:
java.io.IOException
-
removeEntry
void removeEntry(java.lang.String key) throws java.io.IOExceptionDeletes/invalidates/removes any cache entries currently stored under the given key.- Parameters:
key-- Throws:
java.io.IOException
-
updateEntry
void updateEntry(java.lang.String key, HttpCacheUpdateCallback callback) throws java.io.IOException, HttpCacheUpdateExceptionAtomically applies the given callback to update an existing cache entry under a given key.- Parameters:
key- indicates which entry to modifycallback- performs the update; seeHttpCacheUpdateCallbackfor details, but roughly the callback expects to be handed the current entry and will return the new value for the entry.- Throws:
java.io.IOExceptionHttpCacheUpdateException
-
-