public function preloadFromCache($key, $container) { $this->_cache->defer('hGetAll', [$this->_cacheNamespace . ':' . $key], function ($data) use($key, $container) { if (!empty($data)) { $container->onArrive($this->unpack($data, $key), $key); } }); }
public function preloadMultiFromCache($keys, $container) { $cacheKeys = []; foreach ($keys as $key) { $cacheKeys[] = $this->_cacheNamespace . ':' . $key; } $this->_cache->defer('mget', [$cacheKeys], function ($vals) use($keys, $container) { foreach ($vals as $index => $data) { if (!empty($data)) { $container->onArrive($this->unpackFromCache($data, $keys[$index]), $keys[$index]); } } }); }