org.shoal.ha.cache.impl.store
Class ReplicatedDataStore<K,V extends java.io.Serializable>

java.lang.Object
  extended by org.shoal.ha.cache.impl.store.ReplicatedDataStore<K,V>
All Implemented Interfaces:
DataStore<K,V>

public class ReplicatedDataStore<K,V extends java.io.Serializable>
extends java.lang.Object
implements DataStore<K,V>

Author:
Mahesh Kannan

Constructor Summary
ReplicatedDataStore(DataStoreContext<K,V> conf, GroupService gs)
           
 
Method Summary
 void close()
          Close this datastore.
 void destroy()
           
 V get(K key)
          Returns the value to which the specified key is mapped in this cache.
 DataStoreContext<K,V> getDataStoreContext()
           
 java.lang.String put(K k, V v)
          Creates or Replaces the object associated with key k.
 void remove(K k)
          Removes the mapping between the key and the object.
 int removeIdleEntries(long idleFor)
          Removes all entries that were not accessed for more than 'idlefor' millis
 int size()
           
 java.lang.String touch(K k, long version, long ts, long ttl)
          Updates the timestamp associated with this entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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: DataStore
Creates or Replaces the object associated with key k.

Specified by:
put in interface DataStore<K,V extends java.io.Serializable>
Parameters:
k - The Key
v - 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: DataStore
Returns the value to which the specified key is mapped in this cache.

Specified by:
get in interface DataStore<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: DataStore
Removes the mapping between the key and the object.

Specified by:
remove in interface DataStore<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: DataStore
Updates the timestamp associated with this entry. see #{removeIdleEntries}

Specified by:
touch in interface DataStore<K,V extends java.io.Serializable>
Parameters:
k - The key
Throws:
DataStoreException

removeIdleEntries

public int removeIdleEntries(long idleFor)
Description copied from interface: DataStore
Removes all entries that were not accessed for more than 'idlefor' millis

Specified by:
removeIdleEntries in interface DataStore<K,V extends java.io.Serializable>
Parameters:
idleFor - Time in milli seconds

close

public void close()
Description copied from interface: DataStore
Close this datastore. This causes all data to be removed(?)

Specified by:
close in interface DataStore<K,V extends java.io.Serializable>

destroy

public void destroy()
Specified by:
destroy in interface DataStore<K,V extends java.io.Serializable>

size

public int size()
Specified by:
size in interface DataStore<K,V extends java.io.Serializable>


Copyright © 2012. All Rights Reserved.