src/Predis.php
private function cache(string $key, string $value, int $cacheTime = null)
    {
        try {
            $this->client->set($key, $value);

            if ($cacheTime !== null) {
                $this->client->expire($key, $cacheTime);
            }
        } catch (\Exception $e) {
            // We don't want exceptions in accessing the cache to break functionality.
            // The cache should be as transparent as possible.
            // If insight is needed into these exceptions,
            // a better way would be by notifying an observer with the errors.
        }
    }
private function cache(string $key, string $value, int $cacheTime = null)
    {
        try {
            $this->client->set($key, $value);

            if ($cacheTime !== null) {
                $this->client->expire($key, $cacheTime);
            }
        } catch (\Exception $e) {
            // We don't want exceptions in accessing the cache to break functionality.
            // The cache should be as transparent as possible.
            // If insight is needed into these exceptions,
            // a better way would be by notifying an observer with the errors.
        }
    }
private function cache ( string $ key , string $ value , int $ cacheTime = null ) { try { $ this -> client -> set ( $ key , $ value ) ; if ( $ cacheTime !== null ) { $ this -> client -> expire ( $ key , $ cacheTime ) ; } } catch ( \ Exception $ e ) { // We don't want exceptions in accessing the cache to break functionality. // The cache should be as transparent as possible. // If insight is needed into these exceptions, // a better way would be by notifying an observer with the errors. } }
Caches the value into redis with errors suppressed.

@param string $key       The key.
@param string $value     The value.
@param int    $cacheTime The optional cache time

@return void
Caches the value into redis with errors suppressed .