You are here

protected function CacheBase::getExpiration in Redis 8

Calculate the correct expiration time.

Parameters

int $expire: The expiration time provided for the cache set.

Return value

int The default expiration if expire is PERMANENT or higher than the default. May return negative values if the item is already expired.

2 calls to CacheBase::getExpiration()
PhpRedis::set in src/Cache/PhpRedis.php
Stores data in the persistent cache.
Predis::set in src/Cache/Predis.php
Stores data in the persistent cache.

File

src/Cache/CacheBase.php, line 233

Class

CacheBase
Base class for redis cache backends.

Namespace

Drupal\redis\Cache

Code

protected function getExpiration($expire) {
  if ($expire == Cache::PERMANENT || $expire > $this->permTtl) {
    return $this->permTtl;
  }
  return $expire - \Drupal::time()
    ->getRequestTime();
}