protected function Redis_Cache::refreshPermTtl in Redis 7.3
Find from Drupal variables the right permanent items TTL.
1 call to Redis_Cache::refreshPermTtl()
- Redis_Cache::__construct in lib/
Redis/ Cache.php
File
- lib/
Redis/ Cache.php, line 210
Class
- Redis_Cache
- Because those objects will be spawned during boostrap all its configuration must be set in the settings.php file.
Code
protected function refreshPermTtl() {
$ttl = null;
if (null === ($ttl = variable_get('redis_perm_ttl_' . $this->bin, null))) {
if (null === ($ttl = variable_get('redis_perm_ttl', null))) {
$ttl = self::LIFETIME_PERM_DEFAULT;
}
}
if ($ttl === (int) $ttl) {
$this->permTtl = $ttl;
}
else {
if ($iv = DateInterval::createFromDateString($ttl)) {
// http://stackoverflow.com/questions/14277611/convert-dateinterval-object-to-seconds-in-php
$this->permTtl = $iv->y * 31536000 + $iv->m * 2592000 + $iv->d * 86400 + $iv->h * 3600 + $iv->i * 60 + $iv->s;
}
else {
// Sorry but we have to log this somehow.
trigger_error(sprintf("Parsed TTL '%s' has an invalid value: switching to default", $ttl));
$this->permTtl = self::LIFETIME_PERM_DEFAULT;
}
}
}