ICacheCallback

Description

interface Tinman.Core.Caching.ICacheCallback<TId in>

Extended by

DataCache abstract

Callback interface used by ICache implementations.

A ICacheCallback object is responsible for loading cache pages when they are requested for the first time and unloading existing cache pages when they are evicted from the cache.

Page loading can also be performed by the code that calls Fetch, after analysing the return value.

Public / Methods

Cache​Page​Choose


public method CachePageChoose → (2)

pageIndex in : int32

The cache page index.

partially in : bool

Going to do partial load of cache page (see PageLoadFlags.Partial)?

returns → bool

true if the cache page will be reused, false if not.

When a cache page needs to be (re-)used, this method is called for each candidate until an invocation returns true.

Cache​Page​Data


public method CachePageData → (5)

pageIndex in : int32

The cache page index.

write in : int32

Depicts how to write cache page data:
<0 : Do not write cache page data.
0 : Unload partial page (no longer present in the cache).
1 : Unload full page (no longer present in the cache).
2 : Flush partial page (still present in the cache).
3 : Flush full page (still present in the cache).

writeId in : TId

The cache page ID currently loaded in pageIndex in iff write in is greater than or equal to 0.

read in : int32

Depicts how to load the cache page:
<0 : Do not load the page.
0 : Load partial page (overwrite given cache page)
1 : Load full page (overwrite given cache page)
2 : Finish loading of partial page (complete given cache page)

readId in : TId

The cache page ID to load into pageIndex in iff read in is greater than or equal to 0.

Performs writing and/or reading of cache page data.

Writing must always be done first, following by cache page reading.