org.sakaiproject.component.framework.memory
Class SiteCacheImpl

java.lang.Object
  extended byorg.sakaiproject.component.framework.memory.MemCache
      extended byorg.sakaiproject.component.framework.memory.SiteCacheImpl
All Implemented Interfaces:
Cache, Cacher, Observer, Runnable, SiteCache

public class SiteCacheImpl
extends MemCache
implements SiteCache

SiteCacheImpl implements the SiteCache.

Version:
$Revision: 3549 $
Author:
University of Michigan, Sakai Software Development Team

Nested Class Summary
 
Nested classes inherited from class org.sakaiproject.component.framework.memory.MemCache
MemCache.CacheEntry
 
Field Summary
protected  Map m_groups
          Map of a group id to a cached site's Group instance.
protected  Map m_pages
          Map of a page id to a cached site's SitePage instance.
protected  Map m_tools
          Map of a tool id to a cached site's tool configuration instance.
 
Fields inherited from class org.sakaiproject.component.framework.memory.MemCache
m_complete, m_disabled, m_eventTrackingService, m_getCount, m_heldEvents, m_hitCount, m_holdEventProcessing, m_logger, m_map, m_memoryService, m_partiallyComplete, m_putCount, m_refresher, m_refresherSleep, m_resourcePattern, m_softRefs, m_thread, m_threadStop
 
Constructor Summary
SiteCacheImpl(BasicMemoryService memoryService, EventTrackingService eventTrackingService, Logger logger, long sleep, String pattern)
          Construct the Cache.
 
Method Summary
 void clear()
          Clear all entries.
 Group getGroup(String groupId)
          Access the group that is part of a cached site, by group Id.
 SitePage getPage(String pageId)
          Access the page that is part of a cached site, by page Id.
 ToolConfiguration getTool(String toolId)
          Access the tool that is part of a cached site, by tool Id.
 void put(Object key, Object payload, int duration)
          Cache an object
 void remove(Object key)
          Remove this entry from the cache.
 
Methods inherited from class org.sakaiproject.component.framework.memory.MemCache
containsKey, containsKeyExpiredOrNot, continueUpdate, destroy, disable, disabled, enable, expire, get, getAll, getAll, getDescription, getExpiredOrNot, getIds, getKeys, getSize, holdEvents, isComplete, isComplete, processEvents, put, referencePath, resetCache, run, setComplete, setComplete, start, stop, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sakaiproject.service.framework.memory.Cache
containsKey, containsKeyExpiredOrNot, destroy, disable, disabled, enable, expire, get, getAll, getAll, getExpiredOrNot, getIds, getKeys, holdEvents, isComplete, isComplete, processEvents, put, setComplete, setComplete
 
Methods inherited from interface org.sakaiproject.service.framework.memory.Cacher
getDescription, getSize, resetCache
 

Field Detail

m_tools

protected Map m_tools
Map of a tool id to a cached site's tool configuration instance.


m_pages

protected Map m_pages
Map of a page id to a cached site's SitePage instance.


m_groups

protected Map m_groups
Map of a group id to a cached site's Group instance.

Constructor Detail

SiteCacheImpl

public SiteCacheImpl(BasicMemoryService memoryService,
                     EventTrackingService eventTrackingService,
                     Logger logger,
                     long sleep,
                     String pattern)
Construct the Cache. No automatic refresh: expire only, from time and events.

Parameters:
sleep - The number of seconds to sleep between expiration checks.
pattern - The "startsWith()" string for all resources that may be in this cache - if null, don't watch events for updates.
Method Detail

put

public void put(Object key,
                Object payload,
                int duration)
Cache an object

Specified by:
put in interface Cache
Overrides:
put in class MemCache
Parameters:
key - The key with which to find the object.
payload - The object to cache.
duration - The time to cache the object (seconds).

clear

public void clear()
Clear all entries.

Specified by:
clear in interface Cache
Overrides:
clear in class MemCache

remove

public void remove(Object key)
Remove this entry from the cache.

Specified by:
remove in interface Cache
Overrides:
remove in class MemCache
Parameters:
key - The cache key.

getTool

public ToolConfiguration getTool(String toolId)
Description copied from interface: SiteCache
Access the tool that is part of a cached site, by tool Id.

Specified by:
getTool in interface SiteCache
Parameters:
toolId - The tool's id.
Returns:
The ToolConfiguration that has this id, from a cached site.

getPage

public SitePage getPage(String pageId)
Description copied from interface: SiteCache
Access the page that is part of a cached site, by page Id.

Specified by:
getPage in interface SiteCache
Parameters:
pageId - The page's id.
Returns:
The SitePage that has this id, from a cached site.

getGroup

public Group getGroup(String groupId)
Description copied from interface: SiteCache
Access the group that is part of a cached site, by group Id.

Specified by:
getGroup in interface SiteCache
Parameters:
groupId - The group id.
Returns:
The Group that has this id, from a cached site.