|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkrati.store.DataCacheImpl
public class DataCacheImpl
DataCache: A Persistent Full Cache. This class is not thread-safe by design. It is expected that the conditions below hold within one JVM.
1. There is one and only one instance of DataCacheImpl for a given cacheDirectory. 2. There is one and only one thread calling the set methods at any given time.It is expected that this class is used in the case of multiple readers and single writer.
Constructor Summary | |
---|---|
DataCacheImpl(int memberIdStart,
int memberIdCount,
File cacheDirectory)
Constructs a data cache with default values below. |
|
DataCacheImpl(int memberIdStart,
int memberIdCount,
File cacheDirectory,
int segmentFileSizeMB)
Constructs a data cache with default values below. |
|
DataCacheImpl(int memberIdStart,
int memberIdCount,
File cacheDirectory,
SegmentFactory segmentFactory)
Constructs a data cache with default values below. |
|
DataCacheImpl(int memberIdStart,
int memberIdCount,
File cacheDirectory,
SegmentFactory segmentFactory,
int segmentFileSizeMB)
Constructs a data cache with default values below. |
|
DataCacheImpl(int memberIdStart,
int memberIdCount,
int maxEntrySize,
int maxEntries,
File cacheDirectory,
SegmentFactory segmentFactory,
int segmentFileSizeMB,
boolean checked)
Constructs a data cache with Segment Compact Factor default to 0.5. |
|
DataCacheImpl(int memberIdStart,
int memberIdCount,
int maxEntrySize,
int maxEntries,
File cacheDirectory,
SegmentFactory segmentFactory,
int segmentFileSizeMB,
double segmentCompactFactor,
boolean checked)
Constructs a data cache. |
Method Summary | |
---|---|
void |
clear()
|
void |
delete(int memberId,
long scn)
|
byte[] |
get(int memberId)
|
int |
get(int memberId,
byte[] dst)
|
int |
get(int memberId,
byte[] dst,
int offset)
|
long |
getHWMark()
Gets the high water mark. |
int |
getIdCount()
|
int |
getIdStart()
|
long |
getLWMark()
Gets the low water mark. |
protected String |
getStatus()
|
void |
persist()
Persist all updates from memory buffer into redo log files in non-blocking mode. |
void |
saveHWMark(long endOfPeriod)
Save the high water mark. |
void |
set(int memberId,
byte[] data,
int offset,
int length,
long scn)
|
void |
set(int memberId,
byte[] data,
long scn)
|
void |
sync()
Force all updates from memory buffer and redo log files to synchronize with the underlying persistent file in blocking mode. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataCacheImpl(int memberIdStart, int memberIdCount, File cacheDirectory) throws Exception
Segment File Size : 256MB Segment Compact Factor : 0.5 Redo entry size : 10000 Number of Redo Entries : 5 Data integrity check : No Segment Factory : MemorySegmentFactory
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)cacheDirectory
- Cache directory where persistent data will be stored
Exception
public DataCacheImpl(int memberIdStart, int memberIdCount, File cacheDirectory, int segmentFileSizeMB) throws Exception
Segment Compact Factor : 0.5 Redo entry size : 10000 Number of Redo Entries : 5 Data integrity check : No Segment Factory : MemorySegmentFactory
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)cacheDirectory
- Cache directory where persistent data will be storedsegmentFileSizeMB
- Segment size in MB
Exception
public DataCacheImpl(int memberIdStart, int memberIdCount, File cacheDirectory, SegmentFactory segmentFactory) throws Exception
Segment File Size : 256MB Segment Compact Factor : 0.5 Redo entry size : 10000 Number of Redo Entries : 5 Data integrity check : No
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)cacheDirectory
- Cache directory where persistent data will be storedsegmentFactory
- Factory for creating Segment(s)
Exception
public DataCacheImpl(int memberIdStart, int memberIdCount, File cacheDirectory, SegmentFactory segmentFactory, int segmentFileSizeMB) throws Exception
Segment Compact Factor : 0.5 Redo Entry Size : 10000 Number of redo entries : 5 Data integrity check : No
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)cacheDirectory
- Cache directory where persistent data will be storedsegmentFactory
- Factory for creating Segment(s)segmentFileSizeMB
- Segment size in MB
Exception
public DataCacheImpl(int memberIdStart, int memberIdCount, int maxEntrySize, int maxEntries, File cacheDirectory, SegmentFactory segmentFactory, int segmentFileSizeMB, boolean checked) throws Exception
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)maxEntrySize
- Redo entry size (i.e., batch size)maxEntries
- Number of redo entries required for updating the underlying address arraycacheDirectory
- Cache directory where persistent data will be storedsegmentFactory
- Factory for creating Segment(s)segmentFileSizeMB
- Segment size in MBchecked
- whether to apply default checksum (Adler32) to ensure data integrity
Exception
public DataCacheImpl(int memberIdStart, int memberIdCount, int maxEntrySize, int maxEntries, File cacheDirectory, SegmentFactory segmentFactory, int segmentFileSizeMB, double segmentCompactFactor, boolean checked) throws Exception
memberIdStart
- Start of memberIdmemberIdCount
- Total of memberId(s)maxEntrySize
- Redo entry size (i.e., batch size)maxEntries
- Number of redo entries required for updating the underlying address arraycacheDirectory
- Cache directory where persistent data will be storedsegmentFactory
- Factory for creating Segment(s)segmentFileSizeMB
- Segment size in MBsegmentCompactFactor
- Load factor of segment, below which a segment is eligible for compactionchecked
- whether to apply default checksum (Adler32) to ensure data integrity
Exception
Method Detail |
---|
protected String getStatus()
public int getIdCount()
getIdCount
in interface DataCache
public int getIdStart()
getIdStart
in interface DataCache
public byte[] get(int memberId)
get
in interface DataCache
public int get(int memberId, byte[] dst)
get
in interface DataCache
public int get(int memberId, byte[] dst, int offset)
get
in interface DataCache
public void set(int memberId, byte[] data, long scn) throws Exception
set
in interface DataCache
Exception
public void set(int memberId, byte[] data, int offset, int length, long scn) throws Exception
set
in interface DataCache
Exception
public void delete(int memberId, long scn) throws Exception
delete
in interface DataCache
Exception
public void sync() throws IOException
Persistable
sync
in interface Persistable
IOException
public void persist() throws IOException
Persistable
persist
in interface Persistable
IOException
public long getHWMark()
Persistable
getHWMark
in interface Persistable
public long getLWMark()
Persistable
getLWMark
in interface Persistable
public void saveHWMark(long endOfPeriod) throws Exception
Persistable
saveHWMark
in interface Persistable
Exception
public void clear() throws IOException
clear
in interface DataCache
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |