org.opencms.cache
Class CmsMemoryObjectCache

java.lang.Object
  extended byorg.opencms.cache.CmsMemoryObjectCache
All Implemented Interfaces:
I_CmsEventListener

public final class CmsMemoryObjectCache
extends java.lang.Object
implements I_CmsEventListener

A singleton memory cache, that stores objects related with keys.

This cache listens the a I_CmsEventListener.EVENT_CLEAR_CACHES event only.

Since:
6.2.3
Version:
$Revision: 1.2 $
Author:
Alexander Kandzior

Field Summary
 
Fields inherited from interface org.opencms.main.I_CmsEventListener
EVENT_BEFORE_PUBLISH_PROJECT, EVENT_CLEAR_CACHES, EVENT_CLEAR_OFFLINE_CACHES, EVENT_CLEAR_ONLINE_CACHES, EVENT_CLEAR_PRINCIPAL_CACHES, EVENT_FLEX_CACHE_CLEAR, EVENT_FLEX_PURGE_JSP_REPOSITORY, EVENT_LOGIN_USER, EVENT_PROJECT_MODIFIED, EVENT_PROPERTY_DEFINITION_CREATED, EVENT_PROPERTY_DEFINITION_MODIFIED, EVENT_PROPERTY_MODIFIED, EVENT_PUBLISH_PROJECT, EVENT_RESOURCE_AND_PROPERTIES_MODIFIED, EVENT_RESOURCE_COPIED, EVENT_RESOURCE_CREATED, EVENT_RESOURCE_DELETED, EVENT_RESOURCE_LIST_MODIFIED, EVENT_RESOURCE_MODIFIED, EVENT_RESOURCES_AND_PROPERTIES_MODIFIED, EVENT_RESOURCES_MODIFIED, EVENT_UPDATE_EXPORTS, KEY_DBCONTEXT, KEY_PROJECTID, KEY_PUBLISHID, KEY_PUBLISHLIST, KEY_REPORT, LISTENERS_FOR_ALL_EVENTS
 
Method Summary
 void cmsEvent(CmsEvent event)
          Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.
 java.lang.Object getCachedObject(java.lang.Class owner, java.lang.String key)
          Returns an object from the cache.
static CmsMemoryObjectCache getInstance()
          Returns the singelton memory Object cache instance.
 void putCachedObject(java.lang.Class owner, java.lang.String key, java.lang.Object value)
          Puts an object into the cache.
protected  void registerEventListener()
          Registers all required event listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CmsMemoryObjectCache getInstance()
Returns the singelton memory Object cache instance.

Returns:
the singelton memory Object cache instance

cmsEvent

public void cmsEvent(CmsEvent event)
Description copied from interface: I_CmsEventListener
Acknowledge the occurrence of the specified event, implement this method to check for CmsEvents in your class.

Specified by:
cmsEvent in interface I_CmsEventListener
Parameters:
event - CmsEvent that has occurred
See Also:
I_CmsEventListener.cmsEvent(org.opencms.main.CmsEvent)

getCachedObject

public java.lang.Object getCachedObject(java.lang.Class owner,
                                        java.lang.String key)
Returns an object from the cache.

Parameters:
owner - the owner class of the cached object (used to ensure keys don't overlapp)
key - the key to lookup the object for
Returns:
an object from the cache, or null if no object matches the given key

putCachedObject

public void putCachedObject(java.lang.Class owner,
                            java.lang.String key,
                            java.lang.Object value)
Puts an object into the cache.

Parameters:
owner - the owner class of the cached object (used to ensure keys don't overlapp)
key - the key to store the object at
value - the object to store

registerEventListener

protected void registerEventListener()
Registers all required event listeners.