Final Class Yiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger
| Inheritance | Yiisoft\Test\Support\SimpleCache\SimpleCacheActionLogger |
|---|---|
| Implements | Psr\SimpleCache\CacheInterface |
Public Methods
Method Details
SimpleCacheActionLogger constructor.
| public __construct( \Psr\SimpleCache\CacheInterface $cacheService, array $cacheData = [] ): mixed | ||
| $cacheService | \Psr\SimpleCache\CacheInterface | |
| $cacheData | array | |
public function __construct(
private CacheInterface $cacheService,
array $cacheData = []
) {
$this->cacheService->setMultiple($cacheData);
}
| public clear( ): boolean |
public function clear(): bool
{
$this->actions[] = Action::createClearAction();
return $this->cacheService->clear();
}
| public delete( string $key ): boolean | ||
| $key | string | |
public function delete(string $key): bool
{
$this->actions[] = Action::createDeleteAction($key);
return $this->cacheService->delete($key);
}
| public deleteMultiple( iterable $keys ): boolean | ||
| $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 get( string $key, mixed $default = null ): mixed | ||
| $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 getActionKeyList( ): array<integer, array{0: string, 1: mixed}> |
public function getActionKeyList(): array
{
$result = [];
foreach ($this->actions as $action) {
$result[] = [$action->getAction(), $action->getKey()];
}
return $result;
}
| public getActions( ): Yiisoft\Test\Support\SimpleCache\Action[] |
public function getActions(): array
{
return $this->actions;
}
| public getCacheService( ): \Psr\SimpleCache\CacheInterface |
public function getCacheService(): CacheInterface
{
return $this->cacheService;
}
| 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);
foreach ($keys as $key) {
$this->actions[] = Action::createGetAction($key);
}
return $this->cacheService->getMultiple($keys, $default);
}
| public has( string $key ): boolean | ||
| $key | string | |
public function has(string $key): bool
{
$this->actions[] = Action::createHasAction($key);
return $this->cacheService->has($key);
}
| public set( string $key, mixed $value, null|integer|DateInterval $ttl = null ): boolean | ||
| $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 setMultiple( iterable $values, null|integer|DateInterval $ttl = null ): boolean | ||
| $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.