Callback interface used by ICache implementations.
interface
|
ICacheCallback
|
with
|
<in
TId>
|
||
base of
|
DataCache
|
An 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.
When
a
cache
page
needs
to
be
(re-)used,
this
method
is
called
for
each
candidate
until
an
invocation
returns
true
.
method
|
CachePageChoose
(int32 pageIndex,
bool partially)
|
||
type
|
bool
|
||
params
|
pageIndex
|
The cache page index. | |
partially
|
Going to do partial load of cache page (see Partial)? | ||
returns
|
true
if
the
cache
page
will
be
reused,
false
if
not. |
Performs writing and/or reading of cache page data.
method
|
CachePageData
(int32 pageIndex,
int32 write,
TId writeId,
int32 read,
TId readId)
|
||
params
|
pageIndex
|
The cache page index. | |
write
|
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
|
The
cache
page
ID
currently
loaded
in
pageIndex
iff
write
is
greater
than
or
equal
to
0 .
|
||
read
|
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
|
The
cache
page
ID
to
load
into
pageIndex
iff
read
is
greater
than
or
equal
to
0 .
|
Remarks:
Writing must always be done first, following by cache page reading.