org.apache.http.impl.client.cache
Class BasicHttpCacheStorage

java.lang.Object
  extended by org.apache.http.impl.client.cache.BasicHttpCacheStorage
All Implemented Interfaces:
HttpCacheStorage

@ThreadSafe
public class BasicHttpCacheStorage
extends Object
implements HttpCacheStorage

Basic HttpCacheStorage implementation backed by an instance of LinkedHashMap. This cache does NOT deallocate resources associated with the cache entries. It is intended for use with HeapResource and similar.

Since:
4.1

Constructor Summary
BasicHttpCacheStorage(CacheConfig config)
           
 
Method Summary
 HttpCacheEntry getEntry(String url)
          Gets an entry from the cache, if it exists
 void putEntry(String url, HttpCacheEntry entry)
          Places a HttpCacheEntry in the cache
 void removeEntry(String url)
          Removes a HttpCacheEntry from the cache
 void updateEntry(String url, HttpCacheUpdateCallback callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicHttpCacheStorage

public BasicHttpCacheStorage(CacheConfig config)
Method Detail

putEntry

public void putEntry(String url,
                     HttpCacheEntry entry)
              throws IOException
Places a HttpCacheEntry in the cache

Specified by:
putEntry in interface HttpCacheStorage
Parameters:
url - Url to use as the cache key
entry - HttpCacheEntry to place in the cache
Throws:
IOException

getEntry

public HttpCacheEntry getEntry(String url)
                        throws IOException
Gets an entry from the cache, if it exists

Specified by:
getEntry in interface HttpCacheStorage
Parameters:
url - Url that is the cache key
Returns:
HttpCacheEntry if one exists, or null for cache miss
Throws:
IOException

removeEntry

public void removeEntry(String url)
                 throws IOException
Removes a HttpCacheEntry from the cache

Specified by:
removeEntry in interface HttpCacheStorage
Parameters:
url - Url that is the cache key
Throws:
IOException

updateEntry

public void updateEntry(String url,
                        HttpCacheUpdateCallback callback)
                 throws IOException
Specified by:
updateEntry in interface HttpCacheStorage
Throws:
IOException


Copyright © 1999-2011 The Apache Software Foundation. All Rights Reserved.