org.silverpeas.cache.service
Class CacheServiceFactory

java.lang.Object
  extended by org.silverpeas.cache.service.CacheServiceFactory

public class CacheServiceFactory
extends Object

Author:
Yohann Chastagnier

Method Summary
static void clearAllThreadCaches()
          Clears all caches associated to the current thread: Request Cache Service Thread Cache Service
static CacheService getApplicationCacheService()
          Gets the cache of the application.
static SimpleCacheService getRequestCacheService()
          Gets a useful cache in relation with a request : after the end of the request execution, the associated cache is trashed.
static SimpleCacheService getSessionCacheService()
          Gets a useful cache in relation with a session : after the end of the session, the associated cache is trashed.
static VolatileResourceCacheService getSessionVolatileResourceCacheService()
          Gets the volatile resource cache linked to the current user session.
static SimpleCacheService getThreadCacheService()
          Gets a useful volatile cache : after the end of the current thread execution, the associated cache is trashed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getThreadCacheService

public static SimpleCacheService getThreadCacheService()
Gets a useful volatile cache : after the end of the current thread execution, the associated cache is trashed. BE VERY VERE VERY CAREFULLY : into web application with thread pool management, the thread is never killed and this cache is never cleared. If you want the cache cleared after a end of request, please use getRequestCacheService().

Returns:
a cache associated to the current thread

getRequestCacheService

public static SimpleCacheService getRequestCacheService()
Gets a useful cache in relation with a request : after the end of the request execution, the associated cache is trashed.

Returns:
a cache associated to the current request

getSessionCacheService

public static SimpleCacheService getSessionCacheService()
Gets a useful cache in relation with a session : after the end of the session, the associated cache is trashed. If no session cache exists, then the request cache is returned.

Returns:
a cache associated to the current session, or a request if no session one.

getSessionVolatileResourceCacheService

public static VolatileResourceCacheService getSessionVolatileResourceCacheService()
Gets the volatile resource cache linked to the current user session.
For example (and for now), this cache permits to handle attachments linked to a contribution not yet persisted. In case of the user does not persist its contribution, all resources linked to a "volatile" contribution (attachments for the example) are automatically deleted on the user session closing.

Returns:
the volatile resource cache linked to the current user session.

getApplicationCacheService

public static CacheService getApplicationCacheService()
Gets the cache of the application.

Returns:
an applicative cache service

clearAllThreadCaches

public static void clearAllThreadCaches()
Clears all caches associated to the current thread:



Copyright © 2016 Silverpeas. All Rights Reserved.