org.rythmengine.extension
Interface ICacheService

All Known Implementing Classes:
NoCacheService, SimpleCacheService

public interface ICacheService

Define cache service


Method Summary
 void clear()
          Remove all cached items
 boolean contains(String key)
          Check if the cache contains key
 Serializable get(String key)
          Return an item from the cache service by key
 void put(String key, Serializable value)
          Store an item into the cache by key and use default ttl
 void put(String key, Serializable value, int ttl)
          Store an item into the cache service by key and set ttl value
 Serializable remove(String key)
          Remove an item from cache service by key
 void setDefaultTTL(int ttl)
          Set default ttl value which will be used if user pass 0 as ttl or not specified ttl
 void shutdown()
          Shutdown the cache service
 void startup()
          Restart the cache service after shutdown
 

Method Detail

put

void put(String key,
         Serializable value,
         int ttl)
Store an item into the cache service by key and set ttl value

Parameters:
key -
value -
ttl - time to live of the cached item. Time unit is second. If set to negative number, then it will never expire. If set to zero then the default ttl value will be used

put

void put(String key,
         Serializable value)
Store an item into the cache by key and use default ttl

Parameters:
key -
value -

remove

Serializable remove(String key)
Remove an item from cache service by key

Parameters:
key -
Returns:
the value associated with the key

get

Serializable get(String key)
Return an item from the cache service by key

Parameters:
key -
Returns:
the value associated with the key

contains

boolean contains(String key)
Check if the cache contains key

Parameters:
key -
Returns:
true if key is found in the cache

clear

void clear()
Remove all cached items


setDefaultTTL

void setDefaultTTL(int ttl)
Set default ttl value which will be used if user pass 0 as ttl or not specified ttl

Parameters:
ttl -

shutdown

void shutdown()
Shutdown the cache service


startup

void startup()
Restart the cache service after shutdown

Note, by default the cache service should be started after initialized



Copyright © 2013. All Rights Reserved.