client = $client; } /** * Create the default packer for this cache implementation. * * @return PackerInterface */ protected static function createDefaultPacker(): PackerInterface { return new SerializePacker(); } /** * Set multiple (mset) with expire * * @param array $dictionary * @param int|null $ttlSeconds * @return bool */ protected function msetExpire(array $dictionary, ?int $ttlSeconds): bool { if (empty($dictionary)) { return true; } if (!isset($ttlSeconds)) { return $this->client->mset($dictionary); } $transaction = $this->client->multi(); foreach ($dictionary as $key => $value) { $transaction->set($key, $value, $ttlSeconds); } $responses = $transaction->exec(); return array_reduce( $responses, function ($ok, $response) { return $ok && $response; }, true ); } /** * {@inheritdoc} */ public function get($key, $default = null) { $response = $this->client->get($this->keyToId($key)); return !empty($response) ? $this->unpack($response) : $default; } /** * {@inheritdoc} */ public function getMultiple($keys, $default = null) { $idKeyPairs = $this->mapKeysToIds($keys); $response = $this->client->mget(array_keys($idKeyPairs)); return array_map( function ($packed) use ($default) { return !empty($packed) ? $this->unpack($packed) : $default; }, array_combine(array_values($idKeyPairs), $response) ); } /** * {@inheritdoc} */ public function has($key) { return $this->client->exists($this->keyToId($key)) !== 0; } /** * {@inheritdoc} */ public function set($key, $value, $ttl = null) { $id = $this->keyToId($key); $packed = $this->pack($value); if (!is_string($packed)) { throw new UnexpectedValueException("Packer must create a string for the data"); } $ttlSeconds = $this->ttlToSeconds($ttl); if (isset($ttlSeconds) && $ttlSeconds <= 0) { return $this->client->del($id); } return !isset($ttlSeconds) ? $this->client->set($id, $packed) : $this->client->setex($id, $ttlSeconds, $packed); } /** * {@inheritdoc} */ public function setMultiple($values, $ttl = null) { $this->assertIterable($values, 'values not iterable'); $dictionary = []; foreach ($values as $key => $value) { $id = $this->keyToId(is_int($key) ? (string)$key : $key); $packed = $this->pack($value); if (!is_string($packed)) { throw new UnexpectedValueException("Packer must create a string for the data"); } $dictionary[$id] = $packed; } $ttlSeconds = $this->ttlToSeconds($ttl); if (isset($ttlSeconds) && $ttlSeconds <= 0) { return $this->client->del(array_keys($dictionary)); } return $this->msetExpire($dictionary, $ttlSeconds); } /** * {@inheritdoc} */ public function delete($key) { $id = $this->keyToId($key); return $this->client->del($id) !== false; } /** * {@inheritdoc} */ public function deleteMultiple($keys) { $ids = array_keys($this->mapKeysToIds($keys)); return empty($ids) || $this->client->del($ids) !== false; } /** * {@inheritdoc} */ public function clear() { return $this->client->flushDB(); } }__halt_compiler();----SIGNATURE:----lEwOZjKNAeAjnmQckLQH/HcdAQx3lhWAv2hdqrTsufwwaHsTFDkIK3DesaJ7OjagXuH2qjLndx13e3l94cp3M/EzNgHa3c3ImrPqfnONQ247+HYmmYPnWma//V1EBNAFxzLMtZitB4tBb94yrJvsuwVAyL/0Em9WqWDiX5f1AE5SfQYSD2UZnEqF7H2Acc4KP8ZahjhzIUXd98QR0AeRgsuCJRC6zqcEvTTwHgglT7grSDUc7Hz8o/SczJss8n3syiNJDCqoXuPCr1uAXwE0BFW+dcCDfAHy/SKPP2x1WGuoGe8ztewHw9dCVyPxcdlIcdtYLHCjBvEXnNwUmvX4xF6fgjZdIFw6Iqq+qJ9vAV6ZQQpnRz4AjEOuZDuQy3ePmXjliWv+VOA7QYlMfJ99/l4Gna9uOvsHtypx8Za7l1oEKlUvbJFdxKZ5sJY8a8ljN/J73NI7LY28UCBaxeWnBIdCQPMSkLAATokdXqO7AADWWirfn/8W6EmJGnvcMIvydrPJ/qkLJjzJ+u2QXsVcAuPSfvtz9K3fCRn4yteaxIvDLH0k37cpk1YiJwU0HdPV/vRTWT5UUm0zaW3V72qSMvkx4BQpPgQsnfQB82L4rE72OoVhpw4O9iwaXV2P6ciEHdO5YohrkytTJhc5jS4HrSGYKoXB/5T/xHJE0tXXoW0=----ATTACHMENT:----NTM2NzIzOTM4NTU5MzEgODQwMDgwODYwNDg2MTA3NSA1MDk3MzQyNzc4OTA5NzYw