Jive Forums API (5.5.20.2-oracle) Web Services Client Javadocs

com.jivesoftware.forum.webservices
Interface CacheableService


public interface CacheableService

If services are acquired by ServiceLocator you can cast a service to this interface to enable/modify caching settings. Useage: ServiceLocator serviceLocator = .... ContentService contentService = serviceLocator.getContentService(); CacheableService cacheable = (CacheableService) contentService; cacheable.setCacheEnabled(true);

Only service methods that have been marked with commons attribute @@Cacheable() will be cached. The key for the cache is a combination of the method name and the array of parameters passed to the method.

Service methods with the commons attribute @@ClearCache() will clear an entire services cache.


Method Summary
 void clearCache()
          Calling this method will clear the content from the services cache.
 long getMaxCacheLifetime()
          Returns the maximum amount of time an item can be in the cache.
 int getMaxCacheSize()
          Returns the maximum size of the cache.
 boolean isCachingEnabled()
          Returns true if caching is enabled for this service.
 void setCachingEnabled(boolean enabled)
          Setting true to this method will enabled caching, false will disable it and clear current caches.
 void setMaxCacheLifetime(long time)
          Set the maximum amount of time an item will be stored in the cache.
 void setMaxCacheSize(int size)
          The maximum size of the cache in bytes.
 

Method Detail

setCachingEnabled

void setCachingEnabled(boolean enabled)
Setting true to this method will enabled caching, false will disable it and clear current caches.

Parameters:
enabled - Whether or not to enable caching.

isCachingEnabled

boolean isCachingEnabled()
Returns true if caching is enabled for this service.

Returns:
true if caching is enabled for this service.

setMaxCacheLifetime

void setMaxCacheLifetime(long time)
Set the maximum amount of time an item will be stored in the cache. If this method is not set to true, then the default of 30 seconds will be used.

Parameters:
time - How long an item can be in the cache.

getMaxCacheLifetime

long getMaxCacheLifetime()
Returns the maximum amount of time an item can be in the cache.

Returns:
the maximum amount of time an item can be in the cache.

setMaxCacheSize

void setMaxCacheSize(int size)
The maximum size of the cache in bytes. If this is not set default value of 64,000 bytes will be used.

Parameters:
size - Sets the size of the cache.

getMaxCacheSize

int getMaxCacheSize()
Returns the maximum size of the cache.

Returns:
the maximum size of the cache.

clearCache

void clearCache()
Calling this method will clear the content from the services cache.


Jive Forums Project Page

Copyright © 1999-2006 Jive Software.