org.apache.jcs.engine.memory.behavior
Interface IMemoryCache

All Superinterfaces:
ICacheType, java.io.Serializable

public interface IMemoryCache
extends ICacheType

For the framework. Insures methods a MemoryCache needs to access.

Author:
asmuts

Field Summary
 
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE
 
Method Summary
 java.io.Serializable get(java.io.Serializable key)
          Description of the Method
 java.io.Serializable get(java.io.Serializable key, boolean container)
          Description of the Method
 ICompositeCacheAttributes getCacheAttributes()
          Returns the CacheAttributes.
 CompositeCache getCompositeCache()
          Gets the cache hub / region taht the MemoryCache is used by
 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()
          Gets the size attribute of the IMemoryCache object
 void initialize(java.lang.String cacheName, ICompositeCacheAttributes cattr, CompositeCache cache)
          Description of the Method
 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.
 void update(ICacheElement ce)
          Puts an item to the cache.
 void waterfal(ICacheElement ce)
          Throws an item out of memory, if there is a disk cache it will be spooled.
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICacheType
getCacheType
 

Method Detail

initialize

public void initialize(java.lang.String cacheName,
                       ICompositeCacheAttributes cattr,
                       CompositeCache cache)
Description of the Method

Parameters:
cacheName - Description of the Parameter
cattr - Description of the Parameter
cache - Description of the Parameter

getSize

public int getSize()
Gets the size attribute of the IMemoryCache object

Returns:
The size value

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:
An Object[]

remove

public boolean remove(java.io.Serializable key)
               throws java.io.IOException
Removes 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

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 java.io.Serializable get(java.io.Serializable key)
                         throws java.io.IOException
Description of the Method

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

get

public java.io.Serializable get(java.io.Serializable key,
                                boolean container)
                         throws java.io.IOException
Description of the Method

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

waterfal

public void waterfal(ICacheElement ce)
              throws java.io.IOException
Throws an item out of memory, if there is a disk cache it will be spooled.

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.

Returns:
The cacheAttributes value

setCacheAttributes

public void setCacheAttributes(ICompositeCacheAttributes cattr)
Sets the CacheAttributes.

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