com.caucho.server.distcache
Class CacheDataBackingImpl

java.lang.Object
  extended by com.caucho.server.distcache.CacheDataBackingImpl
All Implemented Interfaces:
CacheDataBacking
Direct Known Subclasses:
ClusterDataBacking

public class CacheDataBackingImpl
extends java.lang.Object
implements CacheDataBacking

Manages the distributed cache


Constructor Summary
CacheDataBackingImpl()
           
 
Method Summary
 void close()
          Close the backing.
 DataStore getDataStore()
          Returns the underlying DataStore, used for serialization.
 MnodeStore getMnodeStore()
           
 long getStartupLastUpdateTime()
          Returns the last update time on server startup.
 long getStartupLastUpdateTime(HashKey cacheKey)
          Returns the last update time on server startup.
 java.util.ArrayList<CacheData> getUpdates(HashKey cacheKey, long accessTime, int offset)
          Returns a set of entries since an access time.
 java.util.ArrayList<CacheData> getUpdates(long accessTime, int offset)
          Returns a set of entries since an access time.
 MnodeEntry insertLocalValue(HashKey key, MnodeEntry mnodeUpdate, MnodeEntry oldEntryValue)
          Sets a cache entry
 boolean isDataAvailable(HashKey valueKey)
           
 java.sql.Blob loadBlob(HashKey valueHash)
           
 boolean loadData(HashKey valueHash, WriteStream os)
           
 MnodeEntry loadLocalEntryValue(HashKey key)
          Returns the local value from the database
 boolean putLocalValue(MnodeEntry mnodeValue, HashKey key, MnodeEntry oldEntryValue, MnodeUpdate mnodeUpdate)
          Sets a cache entry
 boolean saveData(HashKey valueHash, StreamSource source, int length)
           
 MnodeEntry saveLocalUpdateTime(HashKey keyHash, MnodeEntry mnodeValue, MnodeEntry oldMnodeValue)
           
 void setDataStore(DataStore dataStore)
           
 void setMnodeStore(MnodeStore mnodeStore)
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheDataBackingImpl

public CacheDataBackingImpl()
Method Detail

setDataStore

public void setDataStore(DataStore dataStore)

setMnodeStore

public void setMnodeStore(MnodeStore mnodeStore)

getDataStore

public DataStore getDataStore()
Description copied from interface: CacheDataBacking
Returns the underlying DataStore, used for serialization.

Specified by:
getDataStore in interface CacheDataBacking

getMnodeStore

public MnodeStore getMnodeStore()
Specified by:
getMnodeStore in interface CacheDataBacking

loadLocalEntryValue

public MnodeEntry loadLocalEntryValue(HashKey key)
Returns the local value from the database

Specified by:
loadLocalEntryValue in interface CacheDataBacking

insertLocalValue

public MnodeEntry insertLocalValue(HashKey key,
                                   MnodeEntry mnodeUpdate,
                                   MnodeEntry oldEntryValue)
Sets a cache entry

Specified by:
insertLocalValue in interface CacheDataBacking

putLocalValue

public boolean putLocalValue(MnodeEntry mnodeValue,
                             HashKey key,
                             MnodeEntry oldEntryValue,
                             MnodeUpdate mnodeUpdate)
Description copied from interface: CacheDataBacking
Sets a cache entry

Specified by:
putLocalValue in interface CacheDataBacking

saveLocalUpdateTime

public MnodeEntry saveLocalUpdateTime(HashKey keyHash,
                                      MnodeEntry mnodeValue,
                                      MnodeEntry oldMnodeValue)
Specified by:
saveLocalUpdateTime in interface CacheDataBacking

loadData

public boolean loadData(HashKey valueHash,
                        WriteStream os)
                 throws java.io.IOException
Specified by:
loadData in interface CacheDataBacking
Throws:
java.io.IOException

loadBlob

public java.sql.Blob loadBlob(HashKey valueHash)
Specified by:
loadBlob in interface CacheDataBacking

saveData

public boolean saveData(HashKey valueHash,
                        StreamSource source,
                        int length)
                 throws java.io.IOException
Specified by:
saveData in interface CacheDataBacking
Throws:
java.io.IOException

isDataAvailable

public boolean isDataAvailable(HashKey valueKey)
Specified by:
isDataAvailable in interface CacheDataBacking

getStartupLastUpdateTime

public long getStartupLastUpdateTime()
Returns the last update time on server startup.

Specified by:
getStartupLastUpdateTime in interface CacheDataBacking

getStartupLastUpdateTime

public long getStartupLastUpdateTime(HashKey cacheKey)
Returns the last update time on server startup.

Specified by:
getStartupLastUpdateTime in interface CacheDataBacking

getUpdates

public java.util.ArrayList<CacheData> getUpdates(long accessTime,
                                                 int offset)
Returns a set of entries since an access time.

Specified by:
getUpdates in interface CacheDataBacking

getUpdates

public java.util.ArrayList<CacheData> getUpdates(HashKey cacheKey,
                                                 long accessTime,
                                                 int offset)
Returns a set of entries since an access time.

Specified by:
getUpdates in interface CacheDataBacking

start

public void start()
Specified by:
start in interface CacheDataBacking

close

public void close()
Description copied from interface: CacheDataBacking
Close the backing.

Specified by:
close in interface CacheDataBacking