Home

Traffic Server Software Developers Kit

INKCacheKeyPinnedSet

Pins the document corresponding to the specified key in the cache so that the garbage collection process does not delete the document from the cache for the specified number of seconds.

Prototype

INKReturnCode INKCacheKeyPinnedSet (INKCacheKey key, time_t pin_in_cache)

Arguments

INKCacheKey key is the cache key for the document to be pinned.

time_t pin_in_cache represents the number of seconds the document is to be pinned in the cache.

Description

Pins the document corresponding to the specified key in the cache for the specified number of seconds specified in pin_in_cache. Once the document is pinned, the garbage collection will not delete this document from the specifed number of seconds and the document can even persist across Traffic Server re-runs. However, after the pin_in_cache interval has expired, the cache may delete the document at any time in order to reclaim space.

To delete this document before the pin_in_cache interval expires, call the INKCacheRemove() function with the document’s cache key.

InkCacheKeyPinnedSet() should be used after a key is created and before writing the document to cache using INKCacheWrite().

Because a document is not pinned in the cache by default, it can be garbage-collected at anytime.

[Note] Note

It is important that the records.config variable proxy.config.cache.permit.pinning (in records.config) is set to 1 to enable pinning.

Returns

INK_SUCCESS if the specified object was successfully pinned in the cache.

INK_ERROR if the pin could not be set or is invalid.