Interface ISqlJetPageCache
-
- All Known Implementing Classes:
SqlJetPageCache
public interface ISqlJetPageCache
The page cache subsystem- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cleanAll()
Mark all dirty list pages as clean Make every page in the cache clean.void
clear()
Discard the contents of the cachevoid
clearSyncFlags()
Clear flags from pages of the page cachevoid
close()
Reset and close the cache objectvoid
drop(ISqlJetPage page)
Remove page from cache Drop a page from the cache.ISqlJetPage
fetch(int pageNumber, boolean createFlag)
Try to obtain a page from the cache.int
getCachesize()
Get the cache-size for the pager-cache.ISqlJetPage
getDirtyList()
Get a list of all dirty pages in the cache, sorted by page numberint
getPageCount()
Return the total number of pages stored in the cacheint
getRefCount()
Return the total number of outstanding page referencesvoid
iterate(ISqlJetPageCallback xIter)
Iterate through all pages currently stored in the cache.void
makeClean(ISqlJetPage page)
Make sure the page is marked as clean.void
makeDirty(ISqlJetPage page)
Make sure the page is marked as dirty.void
move(ISqlJetPage page, int pageNumber)
Change a page number.void
open(int szPage, boolean bPurgeable, ISqlJetPageCallback xStress)
Create a new pager cache.void
release(ISqlJetPage page)
Dereference a page.void
setCacheSize(int cacheSize)
Set the suggested cache-size for the pager-cache.void
setPageSize(int pageSize)
Modify the page-size after the cache has been created.void
truncate(int pageNumber)
Remove all pages with page numbers more than pageNumber.
-
-
-
Method Detail
-
open
void open(int szPage, boolean bPurgeable, ISqlJetPageCallback xStress)
Create a new pager cache. Under memory stress, invoke xStress to try to make pages clean. Only clean and unpinned pages can be reclaimed.- Parameters:
szPage
- Size of every pageszExtra
- Extra space associated with each pagebPurgeable
- True if pages are on backing storexDestroy
- Called to destroy a pagexStress
- Call to try to make pages clean
-
setPageSize
void setPageSize(int pageSize)
Modify 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.- Parameters:
pageSize
-
-
fetch
ISqlJetPage fetch(int pageNumber, boolean createFlag) throws SqlJetException
Try to obtain a page from the cache.- Parameters:
pgno
- Page number to obtaincreateFlag
- If true, create page if it does not exist already- Returns:
- Throws:
SqlJetException
-
release
void release(ISqlJetPage page)
Dereference 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.- Parameters:
page
-- Throws:
SqlJetExceptionRemove
-
drop
void drop(ISqlJetPage page)
Remove 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.- Parameters:
page
-- Throws:
SqlJetExceptionRemove
-
makeDirty
void makeDirty(ISqlJetPage page)
Make sure the page is marked as dirty. If it isn't dirty already, make it so.- Parameters:
page
-- Throws:
SqlJetExceptionRemove
-
makeClean
void makeClean(ISqlJetPage page)
Make sure the page is marked as clean. If it isn't clean already, make it so.- Parameters:
page
-- Throws:
SqlJetExceptionRemove
-
cleanAll
void cleanAll()
Mark all dirty list pages as clean Make every page in the cache clean.- Throws:
SqlJetExceptionRemove
-
move
void move(ISqlJetPage page, int pageNumber)
Change 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.- Parameters:
page
-pageNumber
-- Throws:
SqlJetExceptionRemove
-
truncate
void truncate(int pageNumber)
Remove 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".- Parameters:
pageNumber
-- Throws:
SqlJetExceptionRemove
-
getDirtyList
ISqlJetPage getDirtyList()
Get a list of all dirty pages in the cache, sorted by page number- Returns:
-
close
void close()
Reset and close the cache object
-
clearSyncFlags
void clearSyncFlags()
Clear flags from pages of the page cache- Throws:
SqlJetExceptionRemove
-
clear
void clear()
Discard the contents of the cache
-
getRefCount
int getRefCount()
Return the total number of outstanding page references
-
getPageCount
int getPageCount()
Return the total number of pages stored in the cache
-
iterate
void iterate(ISqlJetPageCallback xIter) throws SqlJetException
Iterate through all pages currently stored in the cache.- Parameters:
xIter
-- Throws:
SqlJetException
-
getCachesize
int getCachesize()
Get the cache-size for the pager-cache.- Returns:
-
setCacheSize
void setCacheSize(int cacheSize)
Set 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.- Parameters:
cacheSize
-
-
-