public function set($key, $data, $ttl = null)
    {
        if ($ttl) {
            $now = new \DateTime('now', new \DateTimeZone('UTC'));
            $expire = (int) $now->format('U') + $ttl;
        } else {
            $expire = 0;
        }

        $entry = array(
            'expire' => $expire,
            'value' => $data
        );

        $this->storage[$key] = $entry;

        return true;
    }
public function set($key, $data, $ttl = null)
    {
        if ($ttl) {
            $now = new \DateTime('now', new \DateTimeZone('UTC'));
            $expire = (int) $now->format('U') + $ttl;
        } else {
            $expire = 0;
        }

        $entry = array(
            'expire' => $expire,
            'value' => $data
        );

        $this->storage[$key] = $entry;

        return true;
    }
public function set ( $ key , $ data , $ ttl = null ) { if ( $ ttl ) { $ now = new \ DateTime ( 'now' , new \ DateTimeZone ( 'UTC' ) ) ; $ expire = ( int ) $ now -> format ( 'U' ) + $ ttl ; } else { $ expire = 0 ; } $ entry = array ( 'expire' => $ expire , 'value' => $ data ) ; $ this -> storage [ $ key ] = $ entry ; return true ; }
Set data to cache storage

@param string $key
@param mixed  $data
@param int    $ttl

@return bool
Set data to cache storage