TSCacheWrite

Synopsis

#include <ts/ts.h>

TSAction TSCacheWrite(TSCont contp, TSCacheKey key)

Description

Asks the Traffic Server cache if :arg:`contp` can start writing the object corresponding to :arg:`key` to the cache.

If the object can be written, the cache calls :arg:`contp` back with the event TS_EVENT_CACHE_OPEN_WRITE. In this case, the cache also passes :arg:`contp` a cache vconnection and :arg:`contp` can then initiate a write operation on that vconnection using TSVConnWrite. The object is not committed to the cache until the vconnection is closed. When all data has been transferred, the user (:arg:`contp`) must do an TSVConnClose. In case of any errors, the user must do an TSVConnAbort(contp, 0).

If the object cannot be written, the cache calls :arg:`contp` back with the event TS_EVENT_CACHE_OPEN_WRITE_FAILED. This can happen, for example, if there is another object with the same :arg:`key` being written to the cache. The user (:arg:`contp`) has the option to cancel the action returned by TSCacheWrite.

Note that reentrant calls are possible, i.e. the cache can call back the user (:arg:`contp`) in the same call.