RedisCache

class RedisCache[K, V](name: String, pool: JedisPool, serializer: BinarySerializer, ktype: Class[K], vtype: Class[V], val ttl: Long) extends Cache[K, V]
Companion:
object
trait Cache[K, V]
class Object
trait Matchable
class Any

Value members

Concrete methods

override def clear(): Unit

Remove all mappings from the cache.

Remove all mappings from the cache.

Definition Classes
Cache
override def evict(key: K): Boolean

Evict specified key

Evict specified key

Definition Classes
Cache
override def exists(key: K): Boolean

Exists key

Exists key

Definition Classes
Cache
override def get(key: K): Option[V]

Get Some(T) or None

Get Some(T) or None

Definition Classes
Cache
override def put(key: K, value: V): Unit

Put a new Value

Put a new Value

Definition Classes
Cache
override def putIfAbsent(key: K, value: V): Boolean

Same with put,but return true when absent

Same with put,but return true when absent

Definition Classes
Cache
def replace(key: K, value: V): Option[V]

return Some(v) when exists old value

return Some(v) when exists old value

def replace(key: K, oldvalue: V, newvalue: V): Boolean

return true is (k,oldvalue) exists

return true is (k,oldvalue) exists

override def touch(key: K): Boolean

Touch the key,restart ttl The default implementation is equivalent to

Touch the key,restart ttl The default implementation is equivalent to

val v = cache.get(k)
if(v.isEmpty) false
else {
  cache.remove(k)
  cache.put(k,v.get)
  true
}
Returns:

false if key not exists

Definition Classes
Cache
override def tti: Long

Time to idle seconds,-1 is forever

Time to idle seconds,-1 is forever

Definition Classes
Cache

Concrete fields

val ttl: Long

Time to live seconds,-1 is forever

Time to live seconds,-1 is forever