19 declare(strict_types=1);
36 if (!class_exists(\Memcached::class)) {
48 return class_exists(\Memcached::class) && $this->
server !== null && $this->
server->getVersion() !==
false;
53 return $this->
server->get($this->
buildKey($container, $key)) !==
false;
56 public function get(
string $container,
string $key): ?
string 58 return $this->
server->get($this->
buildKey($container, $key)) ?: null;
61 public function set(
string $container,
string $key,
string $value,
int $ttl):
void 63 $this->
server->set($this->
buildKey($container, $key), $value, $ttl);
66 public function delete(
string $container,
string $key):
void 74 foreach ($this->
server->getAllKeys() as $key) {
75 if (str_starts_with($key, $prefix)) {
76 $this->
server->set($key,
false, 0);
79 foreach ($this->
server->getAllKeys() as $key) {
80 if (str_starts_with($key, $prefix)) {
86 $this->
server->flushBuffers();
97 $this->
server = new \Memcached(self::PERSISTENT_ID);
99 foreach ($nodes as $node) {
103 $node->getWeight() ?? 100 / count($nodes)
buildKey(string $container, string $key)
buildContainerPrefix(string $container)
server()
description: > This example shows how a Progress Bar can be rendered and updated by the server...
__construct(Config $config)
has(string $container, string $key)
flushContainer(string $container)
__construct(Container $dic, ilPlugin $plugin)
initServer(Config $config)