Package org.shoal.ha.cache.impl.store
Class ReplicatedDataStore<K,V extends java.io.Serializable>
- java.lang.Object
-
- org.shoal.ha.cache.impl.store.ReplicatedDataStore<K,V>
-
-
Constructor Summary
Constructors Constructor Description ReplicatedDataStore(DataStoreContext<K,V> conf, GroupService gs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close this datastore.voiddestroy()Vget(K key)Returns the value to which the specified key is mapped in this cache.DataStoreContext<K,V>getDataStoreContext()java.lang.Stringput(K k, V v)Creates or Replaces the object associated with key k.voidremove(K k)Removes the mapping between the key and the object.intremoveIdleEntries(long idleFor)Removes all entries that were not accessed for more than 'idlefor' millisintsize()java.lang.Stringtouch(K k, long version, long ts, long ttl)Updates the timestamp associated with this entry.
-
-
-
Constructor Detail
-
ReplicatedDataStore
public ReplicatedDataStore(DataStoreContext<K,V> conf, GroupService gs)
-
-
Method Detail
-
getDataStoreContext
public DataStoreContext<K,V> getDataStoreContext()
-
put
public java.lang.String put(K k, V v) throws DataStoreException
Description copied from interface:DataStoreCreates or Replaces the object associated with key k.- Specified by:
putin interfaceDataStore<K,V extends java.io.Serializable>- Parameters:
k- The Keyv- The value. The value must be either serializable of the DataStoreEntryHelper that is associated with this cache must be able to transform this into a serializable.- Throws:
DataStoreException
-
get
public V get(K key) throws DataStoreException
Description copied from interface:DataStoreReturns the value to which the specified key is mapped in this cache.- Specified by:
getin interfaceDataStore<K,V extends java.io.Serializable>- Parameters:
key- The key- Returns:
- The value if the association exists or null.
- Throws:
DataStoreException
-
remove
public void remove(K k) throws DataStoreException
Description copied from interface:DataStoreRemoves the mapping between the key and the object.- Specified by:
removein interfaceDataStore<K,V extends java.io.Serializable>- Parameters:
k- The key- Throws:
DataStoreException
-
touch
public java.lang.String touch(K k, long version, long ts, long ttl) throws DataStoreException
Description copied from interface:DataStoreUpdates the timestamp associated with this entry. see #{removeIdleEntries}- Specified by:
touchin interfaceDataStore<K,V extends java.io.Serializable>- Parameters:
k- The key- Throws:
DataStoreException
-
removeIdleEntries
public int removeIdleEntries(long idleFor)
Description copied from interface:DataStoreRemoves all entries that were not accessed for more than 'idlefor' millis- Specified by:
removeIdleEntriesin interfaceDataStore<K,V extends java.io.Serializable>- Parameters:
idleFor- Time in milli seconds
-
close
public void close()
Description copied from interface:DataStoreClose this datastore. This causes all data to be removed(?)
-
destroy
public void destroy()
-
-