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

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

@ThreadSafe
public class ManagedHttpCacheStorage
extends Object
implements HttpCacheStorage

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 Resource.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.

Since:
4.1

Constructor Summary
ManagedHttpCacheStorage(CacheConfig config)
           
 
Method Summary
 void cleanResources()
           
 HttpCacheEntry getEntry(String url)
           
 void putEntry(String url, HttpCacheEntry entry)
           
 void removeEntry(String url)
           
 void shutdown()
           
 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

ManagedHttpCacheStorage

public ManagedHttpCacheStorage(CacheConfig config)
Method Detail

putEntry

public void putEntry(String url,
                     HttpCacheEntry entry)
              throws IOException
Specified by:
putEntry in interface HttpCacheStorage
Throws:
IOException

getEntry

public HttpCacheEntry getEntry(String url)
                        throws IOException
Specified by:
getEntry in interface HttpCacheStorage
Throws:
IOException

removeEntry

public void removeEntry(String url)
                 throws IOException
Specified by:
removeEntry in interface HttpCacheStorage
Throws:
IOException

updateEntry

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

cleanResources

public void cleanResources()

shutdown

public void shutdown()


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