Home

Traffic Server Software Developers Kit

INKCacheKeyDigestSet

Generates and assigns a cache key to an object that will be cached.

Prototype

INKReturnCode INKCacheKeyDigestSet(INKCacheKey key, const unsigned char *input, int length)

Arguments

INKCacheKey key is the key that will be associated with the cached object. Before calling INKCacheKeyDigestSet, you must create the key with INKCacheKeyCreate. Note that in order to generate unique keys, you must use unique input strings. This means that if the input strings are identical, then INKCacheKeyCreate generates identical keys.

const unsigned char *input is a character string that uniquely identifies the object. In most cases, it's the URL of the object.

int length is the length of the input string.

Description

Generates and assigns a cache key to the object to be cached.

Returns

INK_SUCCESS if the cache key is successfully generated.

INK_ERROR if INKCacheKeyDigestSet cannot be set.

Example
const char *digest_string = "mydigest" 
INKCacheKey mykey; 
INKCacheKeyCreate(&mykey); 
INKCacheKeyDigestSet(mykey,digest_string, strlen(digest_string);