org.apache.turbine.services.cache
Class TurbineGlobalCache

java.lang.Object
  extended byorg.apache.turbine.services.cache.TurbineGlobalCache

public abstract class TurbineGlobalCache
extends java.lang.Object

This is a Facade class for GlobalCacheService. This class provides static methods that call related methods of the implementation of the GlobalCacheService used by the System, according to the settings in TurbineResources.

Version:
$Id: TurbineGlobalCache.java 534527 2007-05-02 16:10:59Z tv $
Author:
Sean Legassick

Constructor Summary
TurbineGlobalCache()
           
 
Method Summary
static void addObject(java.lang.String id, CachedObject o)
          Adds an object to the cache.
static int getCacheSize()
          Returns the current size of the cache.
static int getNumberOfObjects()
          Returns the number of objects in the cache.
static CachedObject getObject(java.lang.String id)
          Gets a cached object given its id (a String).
protected static GlobalCacheService getService()
          Utility method for accessing the service implementation
static void removeObject(java.lang.String id)
          Removes an object from the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbineGlobalCache

public TurbineGlobalCache()
Method Detail

getService

protected static GlobalCacheService getService()
Utility method for accessing the service implementation

Returns:
a GlobalCacheService implementation instance

getObject

public static 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 static 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 static void removeObject(java.lang.String id)
Removes an object from the cache.

Parameters:
id - The String id for the object.

getCacheSize

public static 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 static int getNumberOfObjects()
Returns the number of objects in the cache.

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


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