public function set($key, $value, $ttl = 0) {
        if (is_resource($value)) {
            return false;
        }
        $used_key = $this->getUsedKey($key);
        $res = $this->redis->set($used_key, $this->esc($value));

        if ($res !== 'OK') {
            return false;
        }

        if ($ttl === 0) {
            return true;
        }
        if ($ttl != 0 && $ttl > 2592000) {
            $ttl -= time();
        }
        if ($ttl <= 0) {
            return true;
        }

        return ($this->redis->expire($used_key, $ttl) == 1);
    }
public function set($key, $value, $ttl = 0) {
        if (is_resource($value)) {
            return false;
        }
        $used_key = $this->getUsedKey($key);
        $res = $this->redis->set($used_key, $this->esc($value));

        if ($res !== 'OK') {
            return false;
        }

        if ($ttl === 0) {
            return true;
        }
        if ($ttl != 0 && $ttl > 2592000) {
            $ttl -= time();
        }
        if ($ttl <= 0) {
            return true;
        }

        return ($this->redis->expire($used_key, $ttl) == 1);
    }
public function set ( $ key , $ value , $ ttl = 0 ) { if ( is_resource ( $ value ) ) { return false ; } $ used_key = $ this -> getUsedKey ( $ key ) ; $ res = $ this -> redis -> set ( $ used_key , $ this -> esc ( $ value ) ) ; if ( $ res !== 'OK' ) { return false ; } if ( $ ttl === 0 ) { return true ; } if ( $ ttl != 0 && $ ttl > 2592000 ) { $ ttl -= time ( ) ; } if ( $ ttl <= 0 ) { return true ; } return ( $ this -> redis -> expire ( $ used_key , $ ttl ) == 1 ) ; }
set a specific data in the cache
@param string $key    key used for storing data
@param mixed  $var    data to store
@param int    $ttl    data time expiration
@return boolean       false if failure
set a specific data in the cache