0 follower

Final Class Yiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger

InheritanceYiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger
ImplementsPsr\SimpleCache\CacheInterface

Method Details

Hide inherited methods

__construct() public method

SimpleCacheActionLogger constructor.

public mixed __construct ( \Psr\SimpleCache\CacheInterface $cacheService, array $cacheData = [] )
$cacheService \Psr\SimpleCache\CacheInterface
$cacheData array

                public function __construct(
    private CacheInterface $cacheService,
    array $cacheData = []
) {
    $this->cacheService->setMultiple($cacheData);
}

            
clear() public method

public boolean clear ( )

                public function clear(): bool
{
    $this->actions[] = Action::createClearAction();
    return $this->cacheService->clear();
}

            
delete() public method

public boolean delete ( string $key )
$key string

                public function delete(string $key): bool
{
    $this->actions[] = Action::createDeleteAction($key);
    return $this->cacheService->delete($key);
}

            
deleteMultiple() public method

public boolean deleteMultiple ( iterable $keys )
$keys iterable

                public function deleteMultiple(iterable $keys): bool
{
    $keys = $this->iterableToArray($keys);
    foreach ($keys as $key) {
        $this->actions[] = Action::createDeleteAction($key);
    }
    return $this->cacheService->deleteMultiple($keys);
}

            
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->actions[] = Action::createGetAction($key);
    return $this->cacheService->get($key, $default);
}

            
getActionKeyList() public method

public array<integer, array{0: string, 1: mixed}> getActionKeyList ( )

                public function getActionKeyList(): array
{
    $result = [];
    foreach ($this->actions as $action) {
        $result[] = [$action->getAction(), $action->getKey()];
    }
    return $result;
}

            
getActions() public method

public Yiisoft\Test\Support\SimpleCache\Action[] getActions ( )

                public function getActions(): array
{
    return $this->actions;
}

            
getCacheService() public method

public \Psr\SimpleCache\CacheInterface getCacheService ( )

                public function getCacheService(): CacheInterface
{
    return $this->cacheService;
}

            
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);
    foreach ($keys as $key) {
        $this->actions[] = Action::createGetAction($key);
    }
    return $this->cacheService->getMultiple($keys, $default);
}

            
has() public method

public boolean has ( string $key )
$key string

                public function has(string $key): bool
{
    $this->actions[] = Action::createHasAction($key);
    return $this->cacheService->has($key);
}

            
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->actions[] = Action::createSetAction($key, $value, $ttl);
    return $this->cacheService->set($key, $value, $ttl);
}

            
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);
    foreach ($values as $key => $value) {
        $this->actions[] = Action::createSetAction($key, $value, $ttl);
    }
    return $this->cacheService->setMultiple($values, $ttl);
}