Skip to content
kaythinks edited this page Apr 11, 2020 · 2 revisions

The Redis class is basically a wrapper class for accessing the Redis server. It has the following methods,


public function getValue( string $name) : string

This method is used for getting a key value. It can be called like this e.g (new \App\Systems\Redis())->getValue('genuis').


public function setValue(string $key, $value) : bool

This method is used for setting a key value. It can be called like this e.g (new \App\Systems\Redis())->setValue('genuis','kay').


public function getAllValues()

This method is used for getting all the keys values in the Redis server. It can be called like this e.g (new \App\Systems\Redis())->getAllValues().


public function setex(string $key, $value,int $expiryTime) : bool

This method is used for setting key value with an expiry date. It can be called like this e.g **(new \App\Systems\Redis())->setex('victory','this rocks!',100)*. Note :- The expiry time is in seconds.


public function checkIfExists($keyName) : bool

This method is used for checking if a key exists. It can be called like this e.g (new \App\Systems\Redis())->checkIfExists('genius').


public function flushKeyValue($keyName)

This method is used for removing a key value. It can be called like this e.g (new \App\Systems\Redis())->flushKeyValue('genius').


public function flushAllValues()

This method is used for removing all keys. It can be called like this e.g (new \App\Systems\Redis())->flushAllValues().


Clone this wiki locally