org.apache.jcs.engine.memory
Interface MemoryCache

All Known Implementing Classes:
AbstractMemoryCache

public interface MemoryCache

For the framework. Insures methods a MemoryCache needs to access. Not sure why we use this. Should use teh IMemeoryCache interface. I'll change it later.

Version:
$Id: MemoryCache.java,v 1.16 2005/06/04 02:01:56 asmuts Exp $

Method Summary
 void dispose()
          Destroy the memory cache
 ICacheElement get(java.io.Serializable key)
          Get an item from the cache
 ICompositeCacheAttributes getCacheAttributes()
          Returns the CacheAttributes for the region.
 CompositeCache getCompositeCache()
          Gets the cache hub / region taht the MemoryCache is used by
 java.util.Set getGroupKeys(java.lang.String group)
          Gets the set of keys of objects currently in the group
 java.util.Iterator getIterator()
          Deprecated.  
 java.lang.Object[] getKeyArray()
          Get an Array of the keys for all elements in the memory cache.
 ICacheElement getQuiet(java.io.Serializable key)
          Get an item from the cache without effecting its order or last access time
 int getSize()
          Get the number of elements contained in the memory store
 IStats getStatistics()
          Returns the historical and statistical data for a region's memory cache.
 void initialize(CompositeCache cache)
          Initialize the memory cache
 boolean remove(java.io.Serializable key)
          Removes an item from the cache
 void removeAll()
          Removes all cached items from the cache.
 void setCacheAttributes(ICompositeCacheAttributes cattr)
          Sets the CacheAttributes of the region.
 void update(ICacheElement ce)
          Puts an item to the cache.
 void waterfal(ICacheElement ce)
          Spools the item contained in the provided element to disk
 

Method Detail

initialize

public void initialize(CompositeCache cache)
Initialize the memory cache

Parameters:
cache - The cache (region) this memory store is attached to.

dispose

public void dispose()
             throws java.io.IOException
Destroy the memory cache

Throws:
java.io.IOException

getSize

public int getSize()
Get the number of elements contained in the memory store

Returns:
Element count

getStatistics

public IStats getStatistics()
Returns the historical and statistical data for a region's memory cache.

Returns:
Statistics and Infor for the Memory Cache.

getIterator

public java.util.Iterator getIterator()
Deprecated.  

Get an iterator for all elements in the memory cache. This should be removed since it is fairly dangerous. Other classes should not be able to directly access items in the memory cache.

Returns:
An iterator

getKeyArray

public java.lang.Object[] getKeyArray()
Get an Array of the keys for all elements in the memory cache.

Returns:
Object[]

remove

public boolean remove(java.io.Serializable key)
               throws java.io.IOException
Removes an item from the cache

Parameters:
key - Identifies item to be removed
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

removeAll

public void removeAll()
               throws java.io.IOException
Removes all cached items from the cache.

Throws:
java.io.IOException - Description of the Exception

get

public ICacheElement get(java.io.Serializable key)
                  throws java.io.IOException
Get an item from the cache

Parameters:
key - Description of the Parameter
Returns:
Description of the Return Value
Throws:
java.io.IOException - Description of the Exception

getQuiet

public ICacheElement getQuiet(java.io.Serializable key)
                       throws java.io.IOException
Get an item from the cache without effecting its order or last access time

Parameters:
key - Description of the Parameter
Returns:
The quiet value
Throws:
java.io.IOException - Description of the Exception

waterfal

public void waterfal(ICacheElement ce)
              throws java.io.IOException
Spools the item contained in the provided element to disk

Parameters:
ce - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

update

public void update(ICacheElement ce)
            throws java.io.IOException
Puts an item to the cache.

Parameters:
ce - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

getCacheAttributes

public ICompositeCacheAttributes getCacheAttributes()
Returns the CacheAttributes for the region.

Returns:
The cacheAttributes value

setCacheAttributes

public void setCacheAttributes(ICompositeCacheAttributes cattr)
Sets the CacheAttributes of the region.

Parameters:
cattr - The new cacheAttributes value

getCompositeCache

public CompositeCache getCompositeCache()
Gets the cache hub / region taht the MemoryCache is used by

Returns:
The cache value

getGroupKeys

public java.util.Set getGroupKeys(java.lang.String group)
Gets the set of keys of objects currently in the group

Parameters:
group -
Returns:
a Set of group keys.


Copyright © 2002-2005 Apache Software Foundation. All Rights Reserved.