krati.sos
Interface ObjectCache<T>

Type Parameters:
T - Object to be cached.
All Superinterfaces:
Persistable
All Known Implementing Classes:
ObjectCacheAgent, SerializableObjectCache

public interface ObjectCache<T>
extends Persistable

ObjectCache

Author:
jwu

Method Summary
 void clear()
          Clears this object cache by removing all the persisted data permanently.
 boolean delete(int objectId, long scn)
          Deletes an object based on a user-specified object Id.
 T get(int objectId)
          Gets an object based on a user-specified object Id.
 byte[] getBytes(int objectId)
          Gets an object in raw bytes based on a user-specified object Id.
 int getObjectIdCount()
           
 int getObjectIdStart()
           
 void persist()
          Persists this object cache.
 boolean set(int objectId, T object, long scn)
          Sets an object at a user-specified object Id.
 
Methods inherited from interface krati.Persistable
getHWMark, getLWMark, saveHWMark, sync
 

Method Detail

getObjectIdCount

int getObjectIdCount()
Returns:
the total number of objects in the cache.

getObjectIdStart

int getObjectIdStart()
Returns:
the start of ObjectId(s) allowed by the cache.

get

T get(int objectId)
Gets an object based on a user-specified object Id.

Parameters:
objectId - the Id of an object to be retrieved from the cache.
Returns:
an object associated with the given objectId.

getBytes

byte[] getBytes(int objectId)
Gets an object in raw bytes based on a user-specified object Id.

Parameters:
objectId - the Id of an object to be retrieved from the cache.
Returns:
an object in raw bytes according to the given object Id.

set

boolean set(int objectId,
            T object,
            long scn)
            throws Exception
Sets an object at a user-specified object Id.

Parameters:
objectId - the object Id.
object - the object to put into the cache.
scn - the global scn (equivalent to a time stamp).
Throws:
Exception

delete

boolean delete(int objectId,
               long scn)
               throws Exception
Deletes an object based on a user-specified object Id.

Parameters:
objectId - the object Id.
scn - the global scn (equivalent to a time stamp).
Throws:
Exception

persist

void persist()
             throws IOException
Persists this object cache.

Specified by:
persist in interface Persistable
Throws:
IOException

clear

void clear()
           throws IOException
Clears this object cache by removing all the persisted data permanently.

Throws:
IOException


Copyright © 2011. All Rights Reserved.