db = new Redis(); try { $this->db->connect($rconnect); } catch (Exception $e) { return $e->getMessage(); } try { $this->db->ping(); } catch (Exception $e) { return $e->getMessage(); } try { $this->db->select($rdb); } catch (Exception $e) { return $e->getMessage(); } } public function check(){ try { return $this->db->ping(); } catch (Exception $e) { return $e->getMessage(); } } public function setKey($key, $value, $ttl = null){ $this->db->set($key, $value, $ttl); } public function getValue($key){ return $this->db->get($key); } public function getToken($data, $append = ""){ $this->token = CACHEPREFIX . $append . md5(strtolower($data)); return $this->token; } public function exists($key){ return $this->db->exists($key); } public function delete($key){ return $this->db->delete($key); } public function del($key){ return $this->db->delete($key); } public function flush($token = null){ if ( is_null($token) ) return $this->db->flushDB(); else return $this->db->delete($token); } }