redis->setex(CacheMap::cache_key . ':' . $message_id, 1 * 60, $value); } public function getCache($message_id) { $val = $this->redis->get(CacheMap::cache_key . ':' . $message_id); $array = explode('||', $val); if (count($array) !== 2) return false; list($type, $data) = $array; switch ($type) { case 'string': return $data; break; case 'array': return json_decode($data); } return false; } }