1 | <?php |
||
27 | final class KeyValueStorage implements KeyValueStorageInterface |
||
28 | { |
||
29 | private const TABLE = 'KeyValueStorage'; |
||
30 | private const KEY_KEY = 'key'; |
||
31 | private const VALUE_KEY = 'value'; |
||
32 | |||
33 | /** |
||
34 | * @var Connection |
||
35 | */ |
||
36 | private $connection; |
||
37 | |||
38 | public function __construct(Connection $connection) |
||
42 | |||
43 | /** |
||
44 | * @throws DBALException |
||
45 | */ |
||
46 | public function get(string $namespace, string $key): ?string |
||
63 | |||
64 | /** |
||
65 | * @throws DBALException |
||
66 | */ |
||
67 | public function set(string $namespace, string $key, string $value): void |
||
78 | |||
79 | /** |
||
80 | * @throws DBALException |
||
81 | */ |
||
82 | public function has(string $namespace, string $key): bool |
||
86 | |||
87 | /** |
||
88 | * @throws DBALException |
||
89 | */ |
||
90 | public function remove(string $namespace, string $key): void |
||
98 | |||
99 | /** |
||
100 | * @throws DBALException |
||
101 | */ |
||
102 | private function insert($key, $value): void |
||
112 | |||
113 | /** |
||
114 | * @throws DBALException |
||
115 | */ |
||
116 | private function update($key, $value): void |
||
124 | |||
125 | /** |
||
126 | * @throws DBALException |
||
127 | */ |
||
128 | private function delete($key): void |
||
135 | |||
136 | private function escapeKeys(array $data): array |
||
145 | |||
146 | private function createKey(string $namespace, string $key): string |
||
150 | } |
||
151 |