getCacheKey

The getCacheKey hook is triggered when adding a front end page to the cache. It passes the generated cache key and expects a cache key as return value.

Parameters

  1. string $strCacheKey

    The cache key generated by Contao.

Return Values

Return the original or your modified version of $strCacheKey.

Example

<?php

// config.php
$GLOBALS['TL_HOOKS']['getCacheKey'][] = array('MyClass', 'myGetCacheKey');

// MyClass.php
public function myGetCacheKey($strCacheKey)
{
    // store different cache for morning and afternoon
    $strCacheKey .= (date('h') < 12) ? '.am' : '.pm';

    return $strCacheKey;
}

More information

References

See also

results matching ""

    No results matching ""