0

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, integer|DateInterval|null $ttl null )
$key string
$value mixed
$ttl integer|DateInterval|null

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

            
setMultiple() public method

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

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