voldemort.utils
Class WriteThroughCache<K,V>

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<K,V>
          extended by voldemort.utils.WriteThroughCache<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>

public abstract class WriteThroughCache<K,V>
extends java.util.Hashtable<K,V>

Extends Java HashMap HashMap as a Write through cache
provide a hook to write custom write back strategies

See Also:
Serialized Form

Constructor Summary
WriteThroughCache()
           
 
Method Summary
 V get(java.lang.Object key)
          get() calls the readBack function if the value is not in HashMap otherwise serve copy from hash directly.
 V put(K key, V value)
          Updates the value in HashMap and writeBack as Atomic step
abstract  V readBack(K key)
           
abstract  void writeBack(K key, V value)
           
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WriteThroughCache

public WriteThroughCache()
Method Detail

readBack

public abstract V readBack(K key)

writeBack

public abstract void writeBack(K key,
                               V value)

get

public V get(java.lang.Object key)
get() calls the readBack function if the value is not in HashMap otherwise serve copy from hash directly.

Specified by:
get in interface java.util.Map<K,V>
Overrides:
get in class java.util.Hashtable<K,V>

put

public V put(K key,
             V value)
Updates the value in HashMap and writeBack as Atomic step

Specified by:
put in interface java.util.Map<K,V>
Overrides:
put in class java.util.Hashtable<K,V>


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu