Initiates writing an object to the Traffic Server cache.
INKAction INKCacheWrite (INKCont
contp
, INKCacheKey
key
)
INKCont
is the
continuation the cache calls back (telling it whether the
write operation can proceed).contp
INKCacheKey
is the cache key
that corresponds to the object to be cached.key
Asks the Traffic Server cache if
can start writing
the object (corresponding to key) to the cache.contp
If the object can be written, then the cache calls
back with the
event contp
INK_EVENT_CACHE_OPEN_WRITE
. In this case, the
cache also passes
a cache vconnection in the contp
void *edata
argument;
can then initiate
a write operation on that vconnection using
contp
INKVConnWrite
. The object is not committed
to cache until the vconnection is closed.
If the object cannot be written, then the cache calls
back with the
event contp
INK_EVENT_CACHE_OPEN_WRITE_FAILED
. This can
happen, for example, if there is another object with the same
key being written to the cache. 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 before it's initialized.
INK_CACHE_ERROR_DOC_BUSY
: trying to write
a document while another continuation is writing or reading
it.
Any other value: unknown write failure.
The user (
)
has the option to cancel the action returned by
contp
INKCacheWrite
.
The actual data is written/read to the cache through the
cache vconnection. When the cache calls the user back with
OPEN_READ
or OPEN_WRITE
, it passes a
INKVConn
to the user. The user uses this
vconnection for any data transfer. When all data has been
transferred, the user must do a
INKVConnClose
. In case of any errors, the
user must do an INKVConnAbort(contp,
0).
Note | |
---|---|
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
the API fails.