[Cache] $lifetime cannot be null
This commit is contained in:
parent
236a2145fc
commit
c8c7d4c458
@ -128,7 +128,7 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA
|
|||||||
*
|
*
|
||||||
* @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
* @return array The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
||||||
*/
|
*/
|
||||||
abstract protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array;
|
abstract protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes multiple items from the pool and their corresponding tags.
|
* Removes multiple items from the pool and their corresponding tags.
|
||||||
|
@ -93,7 +93,7 @@ class FilesystemTagAwareAdapter extends AbstractTagAwareAdapter implements Prune
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $removeTagData = []): array
|
protected function doSave(array $values, int $lifetime, array $addTagData = [], array $removeTagData = []): array
|
||||||
{
|
{
|
||||||
$failed = $this->doSaveCache($values, $lifetime);
|
$failed = $this->doSaveCache($values, $lifetime);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class Psr16Adapter extends AbstractAdapter implements PruneableInterface, Resett
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime);
|
return $this->pool->setMultiple($values, 0 === $lifetime ? null : $lifetime);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class RedisTagAwareAdapter extends AbstractTagAwareAdapter
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime, array $addTagData = [], array $delTagData = []): array
|
protected function doSave(array $values, int $lifetime, array $addTagData = [], array $delTagData = []): array
|
||||||
{
|
{
|
||||||
$eviction = $this->getRedisEvictionPolicy();
|
$eviction = $this->getRedisEvictionPolicy();
|
||||||
if ('noeviction' !== $eviction && 0 !== strpos($eviction, 'volatile-')) {
|
if ('noeviction' !== $eviction && 0 !== strpos($eviction, 'volatile-')) {
|
||||||
|
@ -78,7 +78,7 @@ trait AbstractTrait
|
|||||||
*
|
*
|
||||||
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
||||||
*/
|
*/
|
||||||
abstract protected function doSave(array $values, ?int $lifetime);
|
abstract protected function doSave(array $values, int $lifetime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -101,7 +101,7 @@ trait ApcuTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (false === $failures = apcu_store($values, null, $lifetime)) {
|
if (false === $failures = apcu_store($values, null, $lifetime)) {
|
||||||
|
@ -91,7 +91,7 @@ trait DoctrineTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
return $this->provider->saveMultiple($values, $lifetime);
|
return $this->provider->saveMultiple($values, $lifetime);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ trait FilesystemTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
$expiresAt = $lifetime ? (time() + $lifetime) : 0;
|
$expiresAt = $lifetime ? (time() + $lifetime) : 0;
|
||||||
$values = $this->marshaller->marshall($values, $failed);
|
$values = $this->marshaller->marshall($values, $failed);
|
||||||
|
@ -223,7 +223,7 @@ trait MemcachedTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -275,7 +275,7 @@ trait PdoTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
@ -194,7 +194,7 @@ trait PhpFilesTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
$ok = true;
|
$ok = true;
|
||||||
$expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX';
|
$expiry = $lifetime ? time() + $lifetime : 'PHP_INT_MAX';
|
||||||
|
@ -404,7 +404,7 @@ trait RedisTrait
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doSave(array $values, ?int $lifetime)
|
protected function doSave(array $values, int $lifetime)
|
||||||
{
|
{
|
||||||
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
if (!$values = $this->marshaller->marshall($values, $failed)) {
|
||||||
return $failed;
|
return $failed;
|
||||||
|
Reference in New Issue
Block a user