Final Class Yiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger
| Inheritance | Yiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger |
|---|---|
| Implements | Psr\SimpleCache\CacheInterface |
Public Methods
Method Details
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);
}
| public boolean clear ( ) |
public function clear(): bool
{
$this->actions[] = Action::createClearAction();
return $this->cacheService->clear();
}
| public boolean delete ( string $key ) | ||
| $key | string | |
public function delete(string $key): bool
{
$this->actions[] = Action::createDeleteAction($key);
return $this->cacheService->delete($key);
}
| 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);
}
| 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);
}
| 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;
}
| public Yiisoft\Test\Support\SimpleCache\Action[] getActions ( ) |
public function getActions(): array
{
return $this->actions;
}
| public \Psr\SimpleCache\CacheInterface getCacheService ( ) |
public function getCacheService(): CacheInterface
{
return $this->cacheService;
}
| 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);
}
| public boolean has ( string $key ) | ||
| $key | string | |
public function has(string $key): bool
{
$this->actions[] = Action::createHasAction($key);
return $this->cacheService->has($key);
}
| 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);
}
| 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);
}
Signup or Login in order to comment.