org.apache.cassandra.cache
Class SerializingCache<K,V>

java.lang.Object
  extended by org.apache.cassandra.cache.SerializingCache<K,V>
All Implemented Interfaces:
ICache<K,V>

public class SerializingCache<K,V>
extends java.lang.Object
implements ICache<K,V>

Serializes cache values off-heap.


Constructor Summary
SerializingCache(int capacity, boolean useMemoryWeigher, ISerializer<V> serializer)
           
 
Method Summary
 int capacity()
           
 void clear()
           
 boolean containsKey(K key)
           
 V get(java.lang.Object key)
           
 java.util.Set<K> hotKeySet(int n)
           
 boolean isEmpty()
           
 boolean isPutCopying()
           
 java.util.Set<K> keySet()
           
 void put(K key, V value)
           
 boolean putIfAbsent(K key, V value)
           
 void remove(K key)
           
 boolean replace(K key, V oldToReplace, V value)
           
 void setCapacity(int capacity)
           
 int size()
           
 int weightedSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializingCache

public SerializingCache(int capacity,
                        boolean useMemoryWeigher,
                        ISerializer<V> serializer)
Method Detail

capacity

public int capacity()
Specified by:
capacity in interface ICache<K,V>

setCapacity

public void setCapacity(int capacity)
Specified by:
setCapacity in interface ICache<K,V>

isEmpty

public boolean isEmpty()

size

public int size()
Specified by:
size in interface ICache<K,V>

weightedSize

public int weightedSize()
Specified by:
weightedSize in interface ICache<K,V>

clear

public void clear()
Specified by:
clear in interface ICache<K,V>

get

public V get(java.lang.Object key)
Specified by:
get in interface ICache<K,V>

put

public void put(K key,
                V value)
Specified by:
put in interface ICache<K,V>

putIfAbsent

public boolean putIfAbsent(K key,
                           V value)
Specified by:
putIfAbsent in interface ICache<K,V>

replace

public boolean replace(K key,
                       V oldToReplace,
                       V value)
Specified by:
replace in interface ICache<K,V>

remove

public void remove(K key)
Specified by:
remove in interface ICache<K,V>

keySet

public java.util.Set<K> keySet()
Specified by:
keySet in interface ICache<K,V>

hotKeySet

public java.util.Set<K> hotKeySet(int n)
Specified by:
hotKeySet in interface ICache<K,V>

containsKey

public boolean containsKey(K key)
Specified by:
containsKey in interface ICache<K,V>

isPutCopying

public boolean isPutCopying()
Specified by:
isPutCopying in interface ICache<K,V>
Returns:
true if the cache implementation inherently copies the cached values; otherwise, the caller should copy manually before caching shared values like Thrift ByteBuffers.


Copyright © 2012 The Apache Software Foundation