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

java.lang.Object
  extended by org.apache.http.impl.client.cache.BasicHttpCache
All Implemented Interfaces:
HttpCache<CacheEntry>

@ThreadSafe
public class BasicHttpCache
extends Object
implements HttpCache<CacheEntry>

Implements HttpCache using LinkedHashMap for backing store

Since:
4.1

Constructor Summary
BasicHttpCache(int maxEntries)
           
 
Method Summary
 CacheEntry getEntry(String url)
          Gets an entry from the cache, if it exists
 void putEntry(String url, CacheEntry entry)
          Places a CacheEntry in the cache
 void removeEntry(String url)
          Removes a CacheEntry from the cache
 void updateCacheEntry(String url, HttpCacheUpdateCallback<CacheEntry> callback)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicHttpCache

public BasicHttpCache(int maxEntries)
Method Detail

putEntry

public void putEntry(String url,
                     CacheEntry entry)
Places a CacheEntry in the cache

Specified by:
putEntry in interface HttpCache<CacheEntry>
Parameters:
url - Url to use as the cache key
entry - CacheEntry to place in the cache

getEntry

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

Specified by:
getEntry in interface HttpCache<CacheEntry>
Parameters:
url - Url that is the cache key
Returns:
CacheEntry if one exists, or null for cache miss

removeEntry

public void removeEntry(String url)
Removes a CacheEntry from the cache

Specified by:
removeEntry in interface HttpCache<CacheEntry>
Parameters:
url - Url that is the cache key

updateCacheEntry

public void updateCacheEntry(String url,
                             HttpCacheUpdateCallback<CacheEntry> callback)
                      throws HttpCacheOperationException
Specified by:
updateCacheEntry in interface HttpCache<CacheEntry>
Throws:
HttpCacheOperationException


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.