org.rythmengine.cache
Enum EhCacheService

java.lang.Object
  extended by java.lang.Enum<EhCacheService>
      extended by org.rythmengine.cache.EhCacheService
All Implemented Interfaces:
Serializable, Comparable<EhCacheService>, ICacheService

public enum EhCacheService
extends Enum<EhCacheService>
implements ICacheService

implement cache service based on EHCACHE


Enum Constant Summary
INSTANCE
           
 
Method Summary
 void clear()
          Remove all cached items
 boolean contains(String key)
          Check if the cache contains key
 void evict(String key)
          Remove an item from the cache service by 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
static EhCacheService valueOf(String name)
          Returns the enum constant of this type with the specified name.
static EhCacheService[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INSTANCE

public static final EhCacheService INSTANCE
Method Detail

values

public static EhCacheService[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (EhCacheService c : EhCacheService.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static EhCacheService valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

put

public void put(String key,
                Serializable value,
                int ttl)
Description copied from interface: ICacheService
Store an item into the cache service by key and set ttl value

Specified by:
put in interface ICacheService
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

public void put(String key,
                Serializable value)
Description copied from interface: ICacheService
Store an item into the cache by key and use default ttl

Specified by:
put in interface ICacheService

remove

public Serializable remove(String key)
Description copied from interface: ICacheService
Remove an item from cache service by key

Specified by:
remove in interface ICacheService
Returns:
the value associated with the key

evict

public void evict(String key)
Description copied from interface: ICacheService
Remove an item from the cache service by key

Specified by:
evict in interface ICacheService

get

public Serializable get(String key)
Description copied from interface: ICacheService
Return an item from the cache service by key

Specified by:
get in interface ICacheService
Returns:
the value associated with the key

contains

public boolean contains(String key)
Description copied from interface: ICacheService
Check if the cache contains key

Specified by:
contains in interface ICacheService
Returns:
true if key is found in the cache

clear

public void clear()
Description copied from interface: ICacheService
Remove all cached items

Specified by:
clear in interface ICacheService

setDefaultTTL

public void setDefaultTTL(int ttl)
Description copied from interface: ICacheService
Set default ttl value which will be used if user pass 0 as ttl or not specified ttl

Specified by:
setDefaultTTL in interface ICacheService

shutdown

public void shutdown()
Description copied from interface: ICacheService
Shutdown the cache service

Specified by:
shutdown in interface ICacheService

startup

public void startup()
Description copied from interface: ICacheService
Restart the cache service after shutdown

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

Specified by:
startup in interface ICacheService


Copyright © 2014. All Rights Reserved.