> On Apr 12, 2015, at 5:28 PM, Alan M. Carroll <[email protected]> wrote:
>
> This is in response to discussions on IRC and TS-3426. This would replace all
> of the current API functions to control cache ability.
It’s in the Jira, but to be explicit, these are the three APIs that this new
API would deprecate:
TSReturnCode TSHttpTxnServerRespNoStoreSet(TSHttpTxn txnp, int flag);
void TSHttpTxnReqCacheableSet(TSHttpTxn txnp, int flag);
void TSHttpTxnRespCacheableSet(TSHttpTxn txnp, int flag);
We also have to be cognitive of how this interacts (or interferes) with the
TSHttpTxnIsCacheable() API, which asks if a specific request *would be*
cacheable.
But, +1 on this new API from me.
— Leif
>
> TSHttpTxnCacheablility
> ======================
>
> Synopsis
> ------------
>
> `#include <ts/ts.h>`
>
> .. c:function:: TSHttpCacheability TSHttpTxnCacheabilityGet(TSHttpTxn txnp)
> .. c:function:: TSReturnCode TSHttpTxnCacheabilitySet(TSHttpTxn txnp,
> TSHttpCacheabillity value)
>
> Control the cacheability of a transaction.
>
> Description
> ---------------
>
> Setting this value to something other than `TS_HTTP_CACHEABLE_DEFAULT`
> overrides any other setting or property of the transaction.
>
> The valid values are
>
> `TS_HTTP_CACHEABLE_ALWAYS`
> Cache the transaction if possible to store in the cache. Essentially this
> means if the request and the response are valid HTTP it will be cached.
> `TS_HTTP_CACHEABLE_NEVER`
> Do not cache transaction.
> `TS_HTTP_CACHEABLE_DEFAULT`
> Ignore this setting. Determine cacheablity according to the transaction and
> other settings.
>
> The iniital value is `TS_HTTP_CACHEABLE_DEFAULT`.
>
> For finer grained control it is expected the plugin will examine the relevant
> parts of the transaction and call this
> with the appropriate value to override the normal processing as desired. This
> must be called from the
> `TS_HTTP_READ_REQUEST_HDR_HOOK` to the `TS_HTTP_READ_RESPONSE_HDR_HOOK` hooks
> inclusive. After that the cache operation
> will have either started or can no longer be started.
>