Class SqlJetPageCache
java.lang.Object
org.tmatesoft.sqljet.core.internal.pager.SqlJetPageCache
- All Implemented Interfaces:
ISqlJetPageCache
A complete page cache is an instance of this structure.
- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final StringSystem property name for cache size configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanAll()Mark all dirty list pages as clean Make every page in the cache clean.voidclear()Discard the contents of the cachevoidClear flags from pages of the page cachevoidclose()Reset and close the cache objectvoiddrop(ISqlJetPage page) Remove page from cache Drop a page from the cache.fetch(int pgno, boolean createFlag) Try to obtain a page from the cache.intGet the cache-size for the pager-cache.Get a list of all dirty pages in the cache, sorted by page numberintReturn the total number of pages stored in the cacheintReturn the total number of outstanding page referencesvoiditerate(ISqlJetPageCallback iter) Iterate through all pages currently stored in the cache.voidmakeClean(ISqlJetPage page) Make sure the page is marked as clean.voidmakeDirty(ISqlJetPage page) Make sure the page is marked as dirty.voidmove(ISqlJetPage page, int newPgno) Change a page number.voidopen(int szPage, boolean purgeable, ISqlJetPageCallback stress) Create a new pager cache.voidrelease(ISqlJetPage page) Dereference a page.voidsetCacheSize(int mxPage) Set the suggested cache-size for the pager-cache.voidsetPageSize(int pageSize) Modify the page-size after the cache has been created.voidtruncate(int pgno) Remove all pages with page numbers more than pageNumber.
-
Field Details
-
SQLJET_PAGE_CACHE_SIZE
System property name for cache size configuration.- See Also:
-
PAGE_CACHE_SIZE_DEFAULT
public static final int PAGE_CACHE_SIZE_DEFAULT- See Also:
-
PAGE_CACHE_SIZE_MINIMUM
public static final int PAGE_CACHE_SIZE_MINIMUM- See Also:
-
-
Method Details
-
open
Description copied from interface:ISqlJetPageCacheCreate a new pager cache. Under memory stress, invoke xStress to try to make pages clean. Only clean and unpinned pages can be reclaimed.- Specified by:
openin interfaceISqlJetPageCache- Parameters:
szPage- Size of every pagepurgeable- True if pages are on backing storestress- Call to try to make pages clean
-
setPageSize
public void setPageSize(int pageSize) Description copied from interface:ISqlJetPageCacheModify the page-size after the cache has been created. Change the page size for PCache object. This can only happen when the cache is empty.- Specified by:
setPageSizein interfaceISqlJetPageCache- Parameters:
pageSize-
-
fetch
Description copied from interface:ISqlJetPageCacheTry to obtain a page from the cache.- Specified by:
fetchin interfaceISqlJetPageCache- Parameters:
createFlag- If true, create page if it does not exist already- Returns:
- Throws:
SqlJetException
-
release
Description copied from interface:ISqlJetPageCacheDereference a page. When the reference count reaches zero, move the page to the LRU list if it is clean. One release per successful fetch. Page is pinned until released. Reference counted.- Specified by:
releasein interfaceISqlJetPageCache- Parameters:
page-
-
drop
Description copied from interface:ISqlJetPageCacheRemove page from cache Drop a page from the cache. There must be exactly one reference to the page. This function deletes that reference, so after it returns the page pointed to by p is invalid.- Specified by:
dropin interfaceISqlJetPageCache- Parameters:
page-
-
makeDirty
Description copied from interface:ISqlJetPageCacheMake sure the page is marked as dirty. If it isn't dirty already, make it so.- Specified by:
makeDirtyin interfaceISqlJetPageCache- Parameters:
page-
-
makeClean
Description copied from interface:ISqlJetPageCacheMake sure the page is marked as clean. If it isn't clean already, make it so.- Specified by:
makeCleanin interfaceISqlJetPageCache- Parameters:
page-
-
cleanAll
public void cleanAll()Description copied from interface:ISqlJetPageCacheMark all dirty list pages as clean Make every page in the cache clean.- Specified by:
cleanAllin interfaceISqlJetPageCache
-
clearSyncFlags
public void clearSyncFlags()Description copied from interface:ISqlJetPageCacheClear flags from pages of the page cache- Specified by:
clearSyncFlagsin interfaceISqlJetPageCache
-
move
Description copied from interface:ISqlJetPageCacheChange a page number. Used by incr-vacuum. Change the page number of page p to newPgno. If newPgno is 0, then the page object is added to the clean-list and the PGHDR_REUSE_UNLIKELY flag set.- Specified by:
movein interfaceISqlJetPageCache- Parameters:
page-newPgno-
-
truncate
public void truncate(int pgno) Description copied from interface:ISqlJetPageCacheRemove all pages with page numbers more than pageNumber. Reset the cache if pageNumber==0 Drop every cache entry whose page number is greater than "pgno".- Specified by:
truncatein interfaceISqlJetPageCache- Parameters:
pgno-
-
close
public void close()Description copied from interface:ISqlJetPageCacheReset and close the cache object- Specified by:
closein interfaceISqlJetPageCache
-
clear
public void clear()Description copied from interface:ISqlJetPageCacheDiscard the contents of the cache- Specified by:
clearin interfaceISqlJetPageCache
-
getDirtyList
Description copied from interface:ISqlJetPageCacheGet a list of all dirty pages in the cache, sorted by page number- Specified by:
getDirtyListin interfaceISqlJetPageCache- Returns:
-
getRefCount
public int getRefCount()Description copied from interface:ISqlJetPageCacheReturn the total number of outstanding page references- Specified by:
getRefCountin interfaceISqlJetPageCache
-
getPageCount
public int getPageCount()Description copied from interface:ISqlJetPageCacheReturn the total number of pages stored in the cache- Specified by:
getPageCountin interfaceISqlJetPageCache
-
getCachesize
public int getCachesize()Description copied from interface:ISqlJetPageCacheGet the cache-size for the pager-cache.- Specified by:
getCachesizein interfaceISqlJetPageCache- Returns:
-
setCacheSize
public void setCacheSize(int mxPage) Description copied from interface:ISqlJetPageCacheSet the suggested cache-size for the pager-cache. If no global maximum is configured, then the system attempts to limit the total number of pages cached by purgeable pager-caches to the sum of the suggested cache-sizes.- Specified by:
setCacheSizein interfaceISqlJetPageCache- Parameters:
mxPage-
-
iterate
Description copied from interface:ISqlJetPageCacheIterate through all pages currently stored in the cache.- Specified by:
iteratein interfaceISqlJetPageCache- Parameters:
iter-- Throws:
SqlJetException
-