Interface OReadCache
- All Known Implementing Classes:
AsyncReadCache,ODirectMemoryOnlyDiskCache
public interface OReadCache
This class is heart of OrientDB storage model it presents disk backed data cache which works with
direct memory.
Model of this cache is based on page model. All direct memory area is mapped to disk files and each file is split on pages. Page is smallest unit of work. The amount of RAM which can be used for data manipulation is limited so only a subset of data will be really loaded into RAM on demand, if there is not enough RAM to store all data, part of them will by flushed to the disk. If disk cache is closed all changes will be flushed to the disk.
- Since:
- 14.03.13
- Author:
- Andrey Lomakin (a.lomakin-at-orientdb.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMinimum size of memory which may be allocated by cache (in pages). -
Method Summary
Modifier and TypeMethodDescriptionlongaddFile(String fileName, long fileId, OWriteCache writeCache) longaddFile(String fileName, OWriteCache writeCache) allocateNewPage(long fileId, OWriteCache writeCache, OLogSequenceNumber startLSN) voidchangeMaximumAmountOfMemory(long calculateReadCacheMaxMemory) voidclear()voidcloseFile(long fileId, boolean flush, OWriteCache writeCache) voidcloseStorage(OWriteCache writeCache) Closes all files inside of write cache and flushes all associated data.voiddeleteFile(long fileId, OWriteCache writeCache) voiddeleteStorage(OWriteCache writeCache) longloadForRead(long fileId, long pageIndex, OWriteCache writeCache, boolean verifyChecksums) loadForWrite(long fileId, long pageIndex, OWriteCache writeCache, boolean verifyChecksums, OLogSequenceNumber startLSN) voidreleaseFromRead(OCacheEntry cacheEntry) voidreleaseFromWrite(OCacheEntry cacheEntry, OWriteCache writeCache, boolean changed) silentLoadForRead(long extFileId, int pageIndex, OWriteCache writeCache, boolean verifyChecksums) voidtruncateFile(long fileId, OWriteCache writeCache)
-
Field Details
-
MIN_CACHE_SIZE
static final int MIN_CACHE_SIZEMinimum size of memory which may be allocated by cache (in pages). This parameter is used only if related flag is set in constrictor of cache.- See Also:
-
-
Method Details
-
addFile
- Throws:
IOException
-
addFile
- Throws:
IOException
-
loadForWrite
OCacheEntry loadForWrite(long fileId, long pageIndex, OWriteCache writeCache, boolean verifyChecksums, OLogSequenceNumber startLSN) throws IOException - Throws:
IOException
-
loadForRead
OCacheEntry loadForRead(long fileId, long pageIndex, OWriteCache writeCache, boolean verifyChecksums) throws IOException - Throws:
IOException
-
silentLoadForRead
OCacheEntry silentLoadForRead(long extFileId, int pageIndex, OWriteCache writeCache, boolean verifyChecksums) -
releaseFromRead
-
releaseFromWrite
-
allocateNewPage
OCacheEntry allocateNewPage(long fileId, OWriteCache writeCache, OLogSequenceNumber startLSN) throws IOException - Throws:
IOException
-
getUsedMemory
long getUsedMemory() -
clear
void clear() -
truncateFile
- Throws:
IOException
-
closeFile
-
deleteFile
- Throws:
IOException
-
deleteStorage
- Throws:
IOException
-
closeStorage
Closes all files inside of write cache and flushes all associated data.- Parameters:
writeCache- Write cache to close.- Throws:
IOException
-
changeMaximumAmountOfMemory
void changeMaximumAmountOfMemory(long calculateReadCacheMaxMemory)
-