public class CacheRecordManager extends Object implements RecordManager
Modifier and Type | Field and Description |
---|---|
protected CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> |
cache
Cache for underlying RecordManager
|
protected RecordManager |
recMgr
Wrapped RecordManager
|
NAME_DIRECTORY_ROOT
Constructor and Description |
---|
CacheRecordManager(RecordManager recMgr,
CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> cache)
Construct a CacheRecordManager wrapping another RecordManager and
using a given cache policy.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the record manager.
|
void |
commit()
Commit (make persistent) all changes since beginning of transaction.
|
void |
delete(long recid)
Deletes a record.
|
Object |
fetch(long recid)
Fetches a record using standard Java serialization.
|
Object |
fetch(long recid,
Serializer serializer)
Fetches a record using a custom serializer.
|
CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> |
getCachePolicy()
Get the underlying cache policy
|
long |
getNamedObject(String name)
Obtain the record id of a named object.
|
RecordManager |
getRecordManager()
Get the underlying Record Manager.
|
long |
getRoot(int id)
Returns the indicated root rowid.
|
int |
getRootCount()
Returns the number of slots available for "root" rowids.
|
long |
insert(Object obj)
Inserts a new record using a custom serializer.
|
long |
insert(Object obj,
Serializer serializer)
Inserts a new record using a custom serializer.
|
void |
rollback()
Rollback (cancel) all changes since beginning of transaction.
|
void |
setNamedObject(String name,
long recid)
Set the record id of a named object.
|
void |
setRoot(int id,
long rowid)
Sets the indicated root rowid.
|
void |
update(long recid,
Object obj)
Updates a record using standard Java serialization.
|
void |
update(long recid,
Object obj,
Serializer serializer)
Updates a record using a custom serializer.
|
protected void |
updateCacheEntries()
Update all dirty cache objects to the underlying RecordManager.
|
protected RecordManager recMgr
protected CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> cache
public CacheRecordManager(RecordManager recMgr, CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> cache)
recMgr
- Wrapped RecordManagercache
- Cache policypublic RecordManager getRecordManager()
public CachePolicy<Long,jdbm.recman.CacheRecordManager.CacheEntry> getCachePolicy()
public long insert(Object obj) throws IOException
insert
in interface RecordManager
obj
- the object for the new record.IOException
- when one of the underlying I/O operations fails.public long insert(Object obj, Serializer serializer) throws IOException
insert
in interface RecordManager
obj
- the object for the new record.serializer
- a custom serializerIOException
- when one of the underlying I/O operations fails.public void delete(long recid) throws IOException
delete
in interface RecordManager
recid
- the rowid for the record that should be deleted.IOException
- when one of the underlying I/O operations fails.public void update(long recid, Object obj) throws IOException
update
in interface RecordManager
recid
- the recid for the record that is to be updated.obj
- the new object for the record.IOException
- when one of the underlying I/O operations fails.public void update(long recid, Object obj, Serializer serializer) throws IOException
update
in interface RecordManager
recid
- the recid for the record that is to be updated.obj
- the new object for the record.serializer
- a custom serializerIOException
- when one of the underlying I/O operations fails.public Object fetch(long recid) throws IOException
fetch
in interface RecordManager
recid
- the recid for the record that must be fetched.IOException
- when one of the underlying I/O operations fails.public Object fetch(long recid, Serializer serializer) throws IOException
fetch
in interface RecordManager
recid
- the recid for the record that must be fetched.serializer
- a custom serializerIOException
- when one of the underlying I/O operations fails.public void close() throws IOException
close
in interface RecordManager
IOException
- when one of the underlying I/O operations fails.public int getRootCount()
getRootCount
in interface RecordManager
public long getRoot(int id) throws IOException
getRoot
in interface RecordManager
IOException
getRootCount()
public void setRoot(int id, long rowid) throws IOException
setRoot
in interface RecordManager
IOException
getRootCount()
public void commit() throws IOException
commit
in interface RecordManager
IOException
public void rollback() throws IOException
rollback
in interface RecordManager
IOException
public long getNamedObject(String name) throws IOException
getNamedObject
in interface RecordManager
IOException
public void setNamedObject(String name, long recid) throws IOException
setNamedObject
in interface RecordManager
IOException
protected void updateCacheEntries() throws IOException
IOException
Copyright © 2003–2015 The Apache Software Foundation. All rights reserved.