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 \Psr\SimpleCache\CacheInterface for common cache operations that NullCache supports.

Method Details

Hide inherited methods

clear() public method

public clear( ): boolean

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

            
delete() public method

public delete( mixed $key ): boolean
$key mixed

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

            
deleteMultiple() public method

public deleteMultiple( iterable $keys ): boolean
$keys iterable

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

            
get() public method

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

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

            
getMultiple() public method

public getMultiple( iterable $keys, mixed $default null ): iterable
$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 has( string $key ): boolean
$key string

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

            
set() public method

public set( string $key, mixed $value, integer|DateInterval|null $ttl null ): boolean
$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 setMultiple( iterable $values, integer|DateInterval|null $ttl null ): boolean
$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;
}