protected function ApcuRawBackend::getTtl in Supercache 2.0.x
Same name and namespace in other branches
- 8 src/Cache/ApcuRawBackend.php \Drupal\supercache\Cache\ApcuRawBackend::getTtl()
The Cache API uses a unixtimestamp to set expiration. But APC expects a TTL.
Parameters
int $expire:
1 call to ApcuRawBackend::getTtl()
- ApcuRawBackend::apcSet in src/
Cache/ ApcuRawBackend.php - Store a value using apcu_store and adjusting the $expire timestamp to a TTL.
File
- src/
Cache/ ApcuRawBackend.php, line 23 - Contains \Drupal\supercache\Cache\ApcuRawBackend.
Class
- ApcuRawBackend
- Stores cache items in the Alternative PHP Cache User Cache (APCu).
Namespace
Drupal\supercache\CacheCode
protected function getTtl($expire) {
if ($expire == CacheRawBackendInterface::CACHE_PERMANENT) {
// If no ttl is supplied (or if the ttl is 0), the value will persist until it is removed from the cache manually,
// or otherwise fails to exist in the cache (clear, restart, etc.).
return FALSE;
}
$result = $expire - time();
if ($result < 0) {
return 1;
}
return $result;
}