You are here

function _esi__rotate_seed_key in ESI: Edge Side Includes 7.3

Same name and namespace in other branches
  1. 6.2 esi.inc \_esi__rotate_seed_key()

Rotate the seed key.

Return value

String The new 32-character seed key.

2 calls to _esi__rotate_seed_key()
esi_cron in ./esi.module
Implementation of hook_cron(). Every interval, rotate the seed (used to generate the context-cookies). (Each rotation will invalidate the varnish-cache for previously-cached contexts).
_esi__get_seed in ./esi.module
Get the current short-term rotating-seed, which provides the security that users with expired credentials have limited access to secured data.

File

./esi.module, line 552
Adds support for ESI (Edge-Side-Include) integration, allowing components\ to be delivered by ESI, with support for per-component cache times.

Code

function _esi__rotate_seed_key() {
  $seed = '';
  for ($i = 0; $i < 32; $i++) {

    // get a random character from the printable ASCII character set: 32-126
    $seed .= chr(mt_rand(32, 126));
  }
  variable_set('esi_seed_key', $seed);
  variable_set('esi_seed_key_last_changed', time());
  return $seed;
}