ice.net
Interface Cache

All Known Implementing Classes:
FileCache, MemoryCache

public interface Cache

All caches must implement this interface.


Method Summary
 void clear()
          Remove all entries in a cache.
 void clearExpired()
          Remove all entries that has expired.
 void delete(String url, boolean prop)
          Remove a cache entry.
 CachedObject get(String url)
          Retrieve a cached object from the cache.
 long getCurrentSize()
          Returns the size of the cached objects, in bytes.
 long getMaxSize()
          Returns the max size of the sum of the cached objects, in bytes.
 String getName()
          Get the name of the cache.
 boolean has(String url)
          Checks if the cache has an entry corresponding to the supplied url.
 void setExpires(String url, Date expiryDate)
          Set an expiry date for some entry.
 void setManager(CacheManager c)
          Set the callback to the CacheManager
 void setMaxSize(long size)
          Set the max size of the cache.
 void submit(CachedObject o)
          Submit a object to be cached.
 

Method Detail

setManager

public void setManager(CacheManager c)
Set the callback to the CacheManager


submit

public void submit(CachedObject o)
Submit a object to be cached. Used by the CacheManager.

See Also:
CacheManager

has

public boolean has(String url)
Checks if the cache has an entry corresponding to the supplied url.


get

public CachedObject get(String url)
Retrieve a cached object from the cache.

Parameters:
url - The url of the cached object (generated by URL.toString())

delete

public void delete(String url,
                   boolean prop)
Remove a cache entry.

Parameters:
url - The url describing the cache entry which is to be deleted.
prop - Boolean value to determine if deleted entry is to be (possibly)redistributed to other caches

setMaxSize

public void setMaxSize(long size)
Set the max size of the cache.

Parameters:
size - The size in bytes that the cache should be.

getMaxSize

public long getMaxSize()
Returns the max size of the sum of the cached objects, in bytes. If the cache gets larger than this it purges some of its entries, so that it does not exceed the max size.


getCurrentSize

public long getCurrentSize()
Returns the size of the cached objects, in bytes.


clear

public void clear()
Remove all entries in a cache.


clearExpired

public void clearExpired()
Remove all entries that has expired.


getName

public String getName()
Get the name of the cache.


setExpires

public void setExpires(String url,
                       Date expiryDate)
Set an expiry date for some entry.