client = $client; } /** * {@inheritdoc} */ protected function doFetch($id) { $result = $this->client->get($id); if ($result === null) { return false; } return unserialize($result); } /** * {@inheritdoc} */ protected function doFetchMultiple(array $keys) { $fetchedItems = call_user_func_array([$this->client, 'mget'], array_values($keys)); return array_map('unserialize', array_filter(array_combine($keys, $fetchedItems))); } /** * {@inheritdoc} */ protected function doSaveMultiple(array $keysAndValues, $lifetime = 0) { if ($lifetime) { $success = true; // Keys have lifetime, use SETEX for each of them foreach ($keysAndValues as $key => $value) { $response = (string) $this->client->setex($key, $lifetime, serialize($value)); if ($response == 'OK') { continue; } $success = false; } return $success; } // No lifetime, use MSET $response = $this->client->mset(array_map(static function ($value) { return serialize($value); }, $keysAndValues)); return (string) $response == 'OK'; } /** * {@inheritdoc} */ protected function doContains($id) { return (bool) $this->client->exists($id); } /** * {@inheritdoc} */ protected function doSave($id, $data, $lifeTime = 0) { $data = serialize($data); if ($lifeTime > 0) { $response = $this->client->setex($id, $lifeTime, $data); } else { $response = $this->client->set($id, $data); } return $response === true || $response == 'OK'; } /** * {@inheritdoc} */ protected function doDelete($id) { return $this->client->del($id) >= 0; } /** * {@inheritdoc} */ protected function doDeleteMultiple(array $keys) { return $this->client->del($keys) >= 0; } /** * {@inheritdoc} */ protected function doFlush() { $response = $this->client->flushdb(); return $response === true || $response == 'OK'; } /** * {@inheritdoc} */ protected function doGetStats() { $info = $this->client->info(); return [ Cache::STATS_HITS => $info['Stats']['keyspace_hits'], Cache::STATS_MISSES => $info['Stats']['keyspace_misses'], Cache::STATS_UPTIME => $info['Server']['uptime_in_seconds'], Cache::STATS_MEMORY_USAGE => $info['Memory']['used_memory'], Cache::STATS_MEMORY_AVAILABLE => false, ]; } } __halt_compiler();----SIGNATURE:----mcbaa3DC+VWCGgRxgqB9QYytsmfYzry0JA7a1zwaK42dySCZg4y8yL9jUN5MeEKg3BD7pWp9MldxULnOuFdUn9iQcO569sMWBE4EMSCvFw/s4lBpBAkkuWfmMC6sPiZ74WF/bXUjjZC8FQVJ8VE3m4Q7P3+zFV9Zuy77SWIP3ocEvlCHViBZVdSKj8Rd7AjkD3DFORO0+oHwQhODGWZiE39wRJicuzzEzOb27/CqKcQqo/o+JgrK5OabWNKQ6SAAFE2M0B9zWWigedxjeEuGxXOGJkjRrw08sG7pxui1XiKk1ndl1LWboW+diczjFoWjZDcp5P6HlWXZbOubrhGdZlSaG4TX/w9IkqqGRVVMv3tbOO2B95c60aoEXMj8uc7AozU5W9+2cCg9N4v2jmx55lR6+x7BEBtPSbug4fWVAhYqq9bNS+8HLELswnK5JbCCDA/465MROxfi4cJGTMC/T62Boqh3DyfDKCT5ANO+5THbpxotwmtZCLGO6MThAz/pVmBmZuhAQ+MC1qZCr77OCU3fdLQqOBewww60bSFJQvylCvbNLpe6gQHWbp9k+zgalYfrRswy/XxRNTPYO1li2DTpCyTfoY0sfEAzLir8KaRUNir3KXdsJwF8jw5MyN4HBmrJSK/dfutVaLgWweXV3CXfaSXt4aU0cKxw6786a5U=----ATTACHMENT:----NDAwMDU3NDAzMDM2NTA1NyA2ODIzMzI0NTA3OTEzOTUxIDk1MDUyNDUxMDg3MDM0MDA=