0 follower

Final Class Yiisoft\Cache\NullCache

InheritanceYiisoft\Cache\NullCache
ImplementsPsr\SimpleCache\CacheInterface

NullCache does not cache anything reporting success for all methods calls.

By replacing it with some other cache component, one can quickly switch from non-caching mode to caching mode.

See {@see \Psr\SimpleCache\CacheInterface} for common cache operations that NullCache supports.

Method Details

Hide inherited methods

clear() public method

public boolean clear ( )

                public function clear(): bool
{
    return true;
}

            
delete() public method

public boolean delete ( mixed $key )
$key mixed

                public function delete($key): bool
{
    $this->validateKey($key);
    return true;
}

            
deleteMultiple() public method

public boolean deleteMultiple ( iterable $keys )
$keys iterable

                public function deleteMultiple(iterable $keys): bool
{
    $keys = $this->iterableToArray($keys);
    /** @psalm-suppress RedundantCondition */
    $this->validateKeys($keys);
    return true;
}

            
get() public method

public mixed get ( string $key, mixed $default null )
$key string
$default mixed

                public function get(string $key, mixed $default = null): mixed
{
    $this->validateKey($key);
    return $default;
}

            
getMultiple() public method

public iterable getMultiple ( iterable $keys, mixed $default null )
$keys iterable
$default mixed

                public function getMultiple(iterable $keys, mixed $default = null): iterable
{
    $keys = $this->iterableToArray($keys);
    /** @psalm-suppress RedundantCondition */
    $this->validateKeys($keys);
    return array_fill_keys($keys, $default);
}

            
has() public method

public boolean has ( string $key )
$key string

                public function has(string $key): bool
{
    $this->validateKey($key);
    return false;
}

            
set() public method

public boolean set ( string $key, mixed $value, null|integer|DateInterval $ttl null )
$key string
$value mixed
$ttl null|integer|DateInterval

                public function set(string $key, mixed $value, null|int|DateInterval $ttl = null): bool
{
    $this->validateKey($key);
    return true;
}

            
setMultiple() public method

public boolean setMultiple ( iterable $values, null|integer|DateInterval $ttl null )
$values iterable
$ttl null|integer|DateInterval

                public function setMultiple(iterable $values, null|int|DateInterval $ttl = null): bool
{
    $values = $this->iterableToArray($values);
    $this->validateKeysOfValues($values);
    return true;
}