com.parthparekh.service.cache
Interface Cache

All Known Implementing Classes:
CouchbaseImpl, EhCacheImpl, MemcachedImpl

public interface Cache

Cache API with basic cache operations


Method Summary
 boolean evict(java.lang.String key)
          Removes data from cache with specified key
<T> T
get(java.lang.String key, java.lang.Class<T> clazz)
          Retrieves data from cache with specified key
 CacheType getType()
          Returns the CacheType for the cache
<T> boolean
put(java.lang.String key, T value)
          Adds data to the cache
<T> boolean
put(java.lang.String key, T value, int ttl)
          Adds data to the cache with specific ttl
 

Method Detail

put

<T> boolean put(java.lang.String key,
                T value)
Adds data to the cache

Parameters:
key - - cache key
value - - value of object
Returns:
true if the operation is successful, false otherwise

put

<T> boolean put(java.lang.String key,
                T value,
                int ttl)
Adds data to the cache with specific ttl

Parameters:
key - - cache key
value - - value of object
ttl - in seconds
Returns:
true if the operation is successful, false otherwise

evict

boolean evict(java.lang.String key)
Removes data from cache with specified key

Parameters:
key - - cache key
Returns:
true if the operation is successful, false otherwise

get

<T> T get(java.lang.String key,
          java.lang.Class<T> clazz)
Retrieves data from cache with specified key

Parameters:
key - - cache key
clazz - - class type of object
Returns:
value of T object, null otherwise

getType

CacheType getType()
Returns the CacheType for the cache

Returns:
the CacheType of the cache