Replaces a value within the cache.

@param string $key
@param mixed  $content
@param int    $expiry

@return bool
2646
public function replace($key, $content, $expiry = 0)
    {
        if (!$this->get($key)) {
            return false;
        }

        return $this->set($key, $content, $expiry);
    }
572463
public function increment($key, $value = 1, $expiration = 0)
    {
        $new = intval($this->get($key));
        $new += $value;
        $this->set($key, $new, $expiration);
    }
235471
public function store($key, $value, $expiry=0) {
		if ($expiry == 0) {
			$expiry = $this->expiry;
		}
		$entry = new CacheItem();

		$entry->value = serialize($value);
		$entry->expireAt = time() + $expiry;
		$data = serialize($entry);

		$this->store->store($key, $data);

		$this->items[$key] = $entry;
	}
1038075
public function force_set( $key = '', $value = '', $expiry = '' ) {
		if ( true === $this->is_option ) {
			return $this->update_option( $key, $value, $expiry );
		}
		$this->delete_transient( $key );
		return $this->set_transient( $key, $value, $expiry );
	}
1168384
private function storeValueInCache($key, $value, $expiration = null)
    {
        $this->cache[$key] = new MemcacheObject($key, serialize($value), $this->normalizeExpirationTime($expiration));
    }
586689
public function add($key, $value, $expiration = 0)
    {
        return $this->memcached ? $this->memcached->add($key, $value, $expiration) : false;
    }
651744
public function save( $key, $value, $expire = 0 ) {
		$key = $this->get_key( $key );
		wp_cache_set( $key, $value, $this->group, $expire );
	}
1309780
function update_expiration( $key, $expiration = WP_FS__TIME_24_HOURS_IN_SEC ) {
            $this->_logger->entrance( 'key = ' . $key );

            $cache_entry = $this->_options->get_option( $key, false );

            if ( ! is_object( $cache_entry ) ||
                 ! isset( $cache_entry->timestamp ) ||
                 ! is_numeric( $cache_entry->timestamp )
            ) {
                return false;
            }

            $this->set( $key, $cache_entry->result, $expiration, $cache_entry->created );

            return true;
        }
391
public static function set($key, $value, $expire = 0) {
        try {
            self::getCache()->set($key, $value, $expire);
            self::release();
        } catch (\RuntimeException $e) {
            self::release();
            throw $e;
        } catch (\Error $e) {
            self::release();
            throw $e;
        }
    }
284821
public static function expire(string $key)
        {
            if (($cacheValue = self::GetInstance()->get("\$vxnKey:{$key}")) === false) {
                return false;
            }

            return $cacheValue['$_expire'];
        }
884127
protected function doSet(string $key, $data, int $expire = self::EXPIRE): bool
    {
        /**
         * @var $handle \Memcache|\Memcached
         */
        $handle = $this->_handle;

        // 缓存数据
        return $handle->set($key, $data, MEMCACHE_COMPRESSED, $expire);
    }
1052596
public function update( $key, $value = '', $expiry = '' ) {
		if ( $this->is_option ) {
			return $this->update_option( $key, $value, $expiry );
		}
		return true;
	}
530601
public function replace($key, $value, $expiration = 0)
    {
        return $this->memcached ? $this->memcached->replace($key, $value, $expiration) : false;
    }
259490
public function set($key, $value, $expiration = 0)
    {
        $key = $this->createKey($key);
        $this->instance->set($key, $value, $expiration);
        return $this;
    }
1330307
public function store($key, $data, $expiration = 0) {
    $storeData = array(
      'time'   => time(),
      'expire' => $expiration,
      'data'   => serialize($data)
    );
    $dataArray = $this->_loadCache();
    if (true === is_array($dataArray)) {
      $dataArray[$key] = $storeData;
    } else {
      $dataArray = array($key => $storeData);
    }
    $cacheData = json_encode($dataArray);
    file_put_contents($this->getCacheDir(), $cacheData);
    return $this;
  }
1057436
public function set($key, $value, $expiration = 0)
    {
        $file = $this->cacheDir . $this->getDir($key) . $this->getFile($key);

        if (!file_exists(dirname($file))) {
            mkdir(dirname($file), 0755, true);
        }

        $return = file_put_contents($file, $value);
        touch($file, time() + $expiration);

        return $return;
    }
111151
public function add($key, $value, $expiration = null)
    {

        return $this->set($key, $value, $expiration);
    }