ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PHPStatic.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Cache\Adaptor;
22
24
28class PHPStatic implements Adaptor
29{
30 protected static array $cache = [];
31
32 public function __construct(Config $config)
33 {
34 }
35
36 public function isAvailable(): bool
37 {
38 return true;
39 }
40
41 public function has(string $container, string $key): bool
42 {
43 return isset(self::$cache[$container][$key]);
44 }
45
46 public function get(string $container, string $key): ?string
47 {
48 return self::$cache[$container][$key] ?? null;
49 }
50
51 public function set(string $container, string $key, string $value, int $ttl): void
52 {
53 self::$cache[$container][$key] = $value;
54 }
55
56 public function delete(string $container, string $key): void
57 {
58 unset(self::$cache[$container][$key]);
59 }
60
61 public function flushContainer(string $container): void
62 {
63 self::$cache[$container] = [];
64 }
65
66 public function flush(): void
67 {
68 self::$cache = [];
69 }
70}
flushContainer(string $container)
Definition: PHPStatic.php:61
has(string $container, string $key)
Definition: PHPStatic.php:41
__construct(Config $config)
Definition: PHPStatic.php:32
$container
@noRector
Definition: wac.php:37