org.apache.turbine.services.cache
Interface GlobalCacheService

All Superinterfaces:
Initable, Service
All Known Implementing Classes:
TurbineGlobalCacheService

public interface GlobalCacheService
extends Service

GlobalCacheService interface.

Version:
$Id: GlobalCacheService.java 534527 2007-05-02 16:10:59Z tv $
Author:
Dave Bryson

Field Summary
static java.lang.String SERVICE_NAME
           
 
Method Summary
 void addObject(java.lang.String id, CachedObject o)
          Adds an object to the cache.
 void flushCache()
          Flush the cache of all objects.
 int getCacheSize()
          Returns the current size of the cache.
 int getNumberOfObjects()
          Returns the number of objects in the cache.
 CachedObject getObject(java.lang.String id)
          Gets a cached object given its id (a String).
 void removeObject(java.lang.String id)
          Removes an object from the cache.
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
See Also:
Constant Field Values
Method Detail

getObject

public CachedObject getObject(java.lang.String id)
                       throws ObjectExpiredException
Gets a cached object given its id (a String).

Parameters:
id - The String id for the object.
Returns:
A CachedObject.
Throws:
ObjectExpiredException, - if the object has expired in the cache.
ObjectExpiredException

addObject

public void addObject(java.lang.String id,
                      CachedObject o)
Adds an object to the cache.

Parameters:
id - The String id for the object.
o - The object to add to the cache.

removeObject

public void removeObject(java.lang.String id)
Removes an object from the cache.

Parameters:
id - The String id for the object.

getCacheSize

public int getCacheSize()
                 throws java.io.IOException
Returns the current size of the cache.

Returns:
int representing current cache size in number of bytes
Throws:
java.io.IOException

getNumberOfObjects

public int getNumberOfObjects()
Returns the number of objects in the cache.

Returns:
int The current number of objects in the cache.

flushCache

public void flushCache()
Flush the cache of all objects.



Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.