Initiates a cache read or lookup of an object in the Traffic Server cache.
INKAction INKCacheRead (INKCont
contp
, INKCacheKey
key
)
INKCont
is the
continuation the cache calls back (telling it whether the
object exists and can be read).contp
INKCacheKey
is the cache key
corresponding to the object to be read.key
Asks the Traffic Server cache if the object corresponding
to
exists in the
cache and can be read.key
You can do a cache lookup to determine whether or not an
object is in the cache. To do a cache lookup, call
INKCacheRead
on a continuation
. If the object can
be read, then the cache calls
contp
back with the
event contp
INK_EVENT_CACHE_OPEN_READ
. In this case, the
cache also passes
a cache vconnection;
contp
can then initiate
a read operation on that vconnection using
contp
INKVConnRead
.
INKVConnCacheObjectSizeGet
can be used to
determine the size of the object in the cache.
If the object cannot be read (if, for instance, it is not
in the cache), then the cache calls
back with the
event contp
INK_EVENT_CACHE_OPEN_READ_FAILED
. An error
code is passed in the void *edata
argument of
. The error code
can be:contp
INK_CACHE_ERROR_NOT_READY
: trying to
access to the cache while it's not yet initialized.
INK_CACHE_ERROR_NO_DOC
: document does not
exist in cache.
INK_CACHE_ERROR_DOC_BUSY
: trying to read
a document while another continuation is writing on
it.
Any other value: unknown read failure
Finally, once you have performed a cache lookup, you can
write into cache with INKCacheWrite
. The
user (
) also has
the option to cancel the action returned by
contp
INKCacheRead
by using
INKActionCancel
.
Note | |
---|---|
It is up to the user to read the data from the cache
Reentrant calls are possible; in other words, the cache
can call back the user ( |
An INKAction
object if
successful.
INK_ERROR_PTR
if an argument is incorrect or
if the API failed.