org.sakaiproject.service.framework.memory
Interface MemoryService

All Known Implementing Classes:
BasicMemoryService

public interface MemoryService

MemoryService is the interface for the Sakai Memory service.

This tracks memory users (cachers), runs a periodic garbage collection to keep memory available, and can be asked to report memory usage.

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

Method Summary
 long getAvailableMemory()
          Report the amount of available memory.
 String getStatus()
          Get a status report of memory users.
 Cache newCache()
          Construct a Cache.
 Cache newCache(CacheRefresher refresher, long sleep)
          Construct a Cache.
 Cache newCache(CacheRefresher refresher, String pattern)
          Construct a Cache.
 Cache newHardCache()
          Construct a Cache.
 Cache newHardCache(CacheRefresher refresher, long sleep)
          Construct a Cache.
 Cache newHardCache(CacheRefresher refresher, String pattern)
          Construct a special Cache that uses hard references.
 Cache newHardCache(long sleep, String pattern)
          Construct a Cache.
 MultiRefCache newMultiRefCache(long sleep)
          Construct a multi-ref Cache.
 SiteCache newSiteCache(long sleep, String pattern)
          Construct a special Site Cache.
 void registerCacher(Cacher cacher)
          Register as a cache user
 void resetCachers()
          Cause less memory to be used by clearing any optional caches.
 void unregisterCacher(Cacher cacher)
          Unregister as a cache user
 

Method Detail

getAvailableMemory

public long getAvailableMemory()
Report the amount of available memory.

Returns:
the amount of available memory.

resetCachers

public void resetCachers()
                  throws PermissionException
Cause less memory to be used by clearing any optional caches.

Throws:
PermissionException - if the current user does not have permission to do this.

registerCacher

public void registerCacher(Cacher cacher)
Register as a cache user


unregisterCacher

public void unregisterCacher(Cacher cacher)
Unregister as a cache user


newCache

public Cache newCache(CacheRefresher refresher,
                      String pattern)
Construct a Cache. Attempts to keep complete on Event notification by calling the refresher.

Parameters:
refresher - The object that will handle refreshing of event notified modified or added entries.
pattern - The "startsWith()" string for all resources that may be in this cache - if null, don't watch events for updates.

newHardCache

public Cache newHardCache(CacheRefresher refresher,
                          String pattern)
Construct a special Cache that uses hard references. Attempts to keep complete on Event notification by calling the refresher.

Parameters:
refresher - The object that will handle refreshing of event notified modified or added entries.
pattern - The "startsWith()" string for all resources that may be in this cache - if null, don't watch events for updates.

newCache

public Cache newCache(CacheRefresher refresher,
                      long sleep)
Construct a Cache. Automatic refresh handling if refresher is not null.

Parameters:
refresher - The object that will handle refreshing of expired entries.
sleep - The number of seconds to sleep between expiration checks.

newHardCache

public Cache newHardCache(CacheRefresher refresher,
                          long sleep)
Construct a Cache. Automatic refresh handling if refresher is not null.

Parameters:
refresher - The object that will handle refreshing of expired entries.
sleep - The number of seconds to sleep between expiration checks.

newHardCache

public Cache newHardCache(long sleep,
                          String pattern)
Construct a 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 expiration.

newCache

public Cache newCache()
Construct a Cache. No automatic refresh handling.


newHardCache

public Cache newHardCache()
Construct a Cache. No automatic refresh handling.


newSiteCache

public SiteCache newSiteCache(long sleep,
                              String pattern)
Construct a special Site 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.

newMultiRefCache

public MultiRefCache newMultiRefCache(long sleep)
Construct a multi-ref Cache. No automatic refresh: expire only, from time and events.

Parameters:
sleep - The number of seconds to sleep between expiration checks.

getStatus

public String getStatus()
Get a status report of memory users.

Returns:
A status report of memory users.