Jamm\Memory\CouchbaseObject::save PHP Метод

save() публичный Метод

Save variable in memory storage
public save ( string $key, mixed $value, integer $ttl = 259200, array | string $tags = NULL ) : boolean
$key string - key
$value mixed - value
$ttl integer - time to live (store) in seconds
$tags array | string - array of tags for this key
Результат boolean
    public function save($key, $value, $ttl = 259200, $tags = NULL)
    {
        $key = (string) $key;
        $ttl = $this->ttl_to_expiration($ttl);
        try {
            if (false === $this->Couchbase->set($this->prefix . $key, $value, $ttl)) {
                $reason = $this->prefix . $key;
                if (strlen($key) > 250) {
                    $reason = 'key length should be <250';
                }
                $this->ReportError('Couchbase can not store key: ' . $reason, __LINE__);
                return false;
            }
            $this->setKeyTTL($key, $ttl);
            if (!empty($tags)) {
                $this->setTags($key, $tags);
            }
            return true;
        } catch (\Exception $Exception) {
            return false;
        }
    }