com.caucho.server.distcache
Class MnodeStore

java.lang.Object
  extended by com.caucho.server.distcache.MnodeStore

public class MnodeStore
extends java.lang.Object

Manages backing for the cache map.


Nested Class Summary
static class MnodeStore.ExpiredMnode
           
 
Constructor Summary
MnodeStore(javax.sql.DataSource dataSource, java.lang.String tableName, java.lang.String serverName)
           
 
Method Summary
 void close()
           
 void destroy()
           
 long getCount()
           
 javax.sql.DataSource getDataSource()
          Returns the data source.
 long getStartupLastUpdateTime()
          Returns the max update time detected on startup.
 long getStartupLastUpdateTime(HashKey cacheKey)
          Returns the max update time detected on startup.
 java.lang.String getTableName()
          Returns the data source.
 java.util.ArrayList<CacheData> getUpdates(HashKey cacheKey, long updateTime, int offset)
          Returns the maximum update time on startup
 java.util.ArrayList<CacheData> getUpdates(long updateTime, int offset)
          Returns the maximum update time on startup
protected  void init()
           
protected  void initDatabase()
          Create the database, initializing if necessary.
 boolean insert(HashKey id, HashKey cacheKey, MnodeValue mnodeUpdate, long valueDataId, long lastAccessTime, long lastModifiedTime)
          Stores the data, returning true on success
 MnodeEntry load(HashKey id)
          Reads the object from the data store.
 boolean remove(byte[] key)
          Reads the object from the data store.
 java.util.ArrayList<MnodeStore.ExpiredMnode> selectExpiredData(long startOid)
          Clears the expired data
 java.lang.String toString()
           
 boolean updateAccessTime(HashKey id, long itemVersion, long accessTimeout, long accessTime)
          Updates the update time, returning true on success
 boolean updateSave(byte[] key, byte[] cacheHash, MnodeValue mnodeUpdate, long valueDataId, long lastAccessTime, long lastModifiedTime)
          Stores the data, returning true on success
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MnodeStore

public MnodeStore(javax.sql.DataSource dataSource,
                  java.lang.String tableName,
                  java.lang.String serverName)
           throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getDataSource

public javax.sql.DataSource getDataSource()
Returns the data source.


getTableName

public java.lang.String getTableName()
Returns the data source.


getStartupLastUpdateTime

public long getStartupLastUpdateTime()
Returns the max update time detected on startup.


getStartupLastUpdateTime

public long getStartupLastUpdateTime(HashKey cacheKey)
Returns the max update time detected on startup.


init

protected void init()
             throws java.lang.Exception
Throws:
java.lang.Exception

initDatabase

protected void initDatabase()
                     throws java.lang.Exception
Create the database, initializing if necessary.

Throws:
java.lang.Exception

close

public void close()

getUpdates

public java.util.ArrayList<CacheData> getUpdates(long updateTime,
                                                 int offset)
Returns the maximum update time on startup


getUpdates

public java.util.ArrayList<CacheData> getUpdates(HashKey cacheKey,
                                                 long updateTime,
                                                 int offset)
Returns the maximum update time on startup


load

public MnodeEntry load(HashKey id)
Reads the object from the data store.

Parameters:
id - the hash identifier for the data
Returns:
true on successful load

insert

public boolean insert(HashKey id,
                      HashKey cacheKey,
                      MnodeValue mnodeUpdate,
                      long valueDataId,
                      long lastAccessTime,
                      long lastModifiedTime)
Stores the data, returning true on success

Parameters:
id - the key hash
value - the value hash
idleTimeout - the item's timeout

updateSave

public boolean updateSave(byte[] key,
                          byte[] cacheHash,
                          MnodeValue mnodeUpdate,
                          long valueDataId,
                          long lastAccessTime,
                          long lastModifiedTime)
Stores the data, returning true on success

Parameters:
id - the key hash
value - the value hash
idleTimeout - the item's timeout

updateAccessTime

public boolean updateAccessTime(HashKey id,
                                long itemVersion,
                                long accessTimeout,
                                long accessTime)
Updates the update time, returning true on success

Parameters:
id - the key hash
itemVersion - the value version
idleTimeout - the item's timeout
updateTime - the item's timeout

remove

public boolean remove(byte[] key)
Reads the object from the data store.

Parameters:
id - the hash identifier for the data
Returns:
true on successful load

selectExpiredData

public java.util.ArrayList<MnodeStore.ExpiredMnode> selectExpiredData(long startOid)
Clears the expired data


getCount

public long getCount()

destroy

public void destroy()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object