public function encode($data, $ttl)
    {
        $expire = null;
        if ($ttl !== null) {
            $expire = time() + $ttl;
        }
        return serialize(array($data, $expire));
    }
public function encode($data, $ttl)
    {
        $expire = null;
        if ($ttl !== null) {
            $expire = time() + $ttl;
        }
        return serialize(array($data, $expire));
    }
public function encode ( $ data , $ ttl ) { $ expire = null ; if ( $ ttl !== null ) { $ expire = time ( ) + $ ttl ; } return serialize ( array ( $ data , $ expire ) ) ; }
Encodes some data to a string so it can be written to disk

@param mixed $data
@param int $ttl
@return string
Encodes some data to a string so it can be written to disk