Saves a value to the cache.

@param string $rawCacheKey The cache key.
@param mixed $value The value.

@return void
322646
private function saveToCache( $rawCacheKey, $value )
	{
		$cacheKey = $rawCacheKey . self::$CACHE_SALT;
		$this->cache->save( $cacheKey, $value );
		if ( $this->debug )
			$this->cache->save( '[C]' . $cacheKey, time() );
	}
946393
private function setToCache(string $key, $value, $ttl = null): void
    {
        $params = func_get_args();

        // Use default TTL if none is provided
        if ($this->cacheTTL && $ttl === null) {
            array_push($params, $this->cacheTTL);
        }

        call_user_func_array([$this->cache(), 'set'], $params);
    }
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;
	}
119961
public function cache($key, $value)
    {
        $fileName = $this->getCacheFilename($key);

        $this->log(
            Mustache_Logger::DEBUG,
            'Writing to template cache: "{fileName}"',
            array('fileName' => $fileName)
        );

        $this->writeFile($fileName, $value);
        $this->load($key);
    }
1121959
public function set(CacheKey $key, $value, /** @noinspection PhpUnusedParameterInspection */
                        $sessionLength = null) {

		$this->cache [$key->getModule()] [$key->getProperty()] = $value;

		return true;
	}
465157
public function set($cacheId, $value)
    {
        $this->setToFirstLevelCache($cacheId, $value);
        $this->secondLevelCache->set($cacheId, $value);
    }
425448
function set( $key, $value, $expiration = WP_FS__TIME_24_HOURS_IN_SEC, $created = WP_FS__SCRIPT_START_TIME ) {
            $this->_logger->entrance( 'key = ' . $key );

            $cache_entry = new stdClass();

            $cache_entry->result    = $value;
            $cache_entry->created   = $created;
            $cache_entry->timestamp = $created + $expiration;
            $this->_options->set_option( $key, $cache_entry, true );
        }
1143607
public function set($key, $value, $timeToLive = null) {
		
		if ($this->useFallback) {
			$filename = $this->getFileName($key);
			//$this->log->trace("Storing value in cache: key '$key', value '".var_export($value, true)."'");
			if ($this->log) {
				$this->log->trace("Storing value in cache: key '$key'");
			}
			
			if (!is_writable($filename)) {
				if (!file_exists($this->getDirectory())) {
					mkdir($this->getDirectory(), 0777, true);
				}
			}
			
			if ($timeToLive == null) {
				if (empty($this->defaultTimeToLive)) {
					$timeOut = 0;
				} else {
					$timeOut = time() + $this->defaultTimeToLive;
				}
			} else {
				$timeOut = time() + $timeToLive;
			}
			
			$fp = fopen($filename, "w");
			fwrite($fp, $timeOut."\n");
			fwrite($fp, serialize($value));
			fclose($fp);
			return;
		}
	
		if ($this->log) {
			$this->log->trace("Storing value in APC cache: key '$key'.");
		}
	
		if ($timeToLive == null) {
			if (empty($this->defaultTimeToLive)) {
				$timeOut = 0;
			} else {
				$timeOut = $this->defaultTimeToLive;
			}
		} else {
			$timeOut = time() + $timeToLive;
		}
	
		$ret = apc_store($key, $value, $timeOut);
		if ($ret == false) {
			if ($this->log) {
				$this->log->error("Error while caching the key '$key' with value '".var_export($value, true)."' in APC cache.");
			}
		}
	}
818596
protected function save($key, $value, $ttl) {
        $this->doctrineCacheInstance->save($key, $value, $ttl);
    }
885090
public function put($key, $value, $minutes = null)
    {
        $this->cache->put($key, $value, $minutes);
    }
616320
protected void putToCache(String cacheName, String key, Object value) {
        putToCache(cacheName, key, value, 0);
    }
842297
function cache($key, $value): void {
    $viewRenderer = $this->viewRenderer;
    if (!$viewRenderer->enableCaching) eval("?>$value");
    else {
      /** @var \yii\caching\Cache $cache */
      $cache = $viewRenderer->cache;
      $cache->set([__CLASS__, $key], $value, $viewRenderer->cachingDuration);
      $this->load($key);
    }
  }
30317
public function set($key,$value)
    {
        $file=$this->getCacheDir().$key;
        file_put_contents($file, serialize($value));
    }
596084
public function saveItem($key, $value, $ttl = null)
    {
        if (!$this->hasItem($key)) {
            $cacheFile = __cache_path().md5($key);
            $fileHandling = new FileHandling();
            $fileHandling->open($cacheFile, 'writeAppend')->write(json_encode([
                'start' => time(),
                'ttl'   => ($ttl !== null) ? (int) $ttl : $this->ttl,
                'value' => $value,
            ]));
            $fileHandling->close();
        }

        return $this;
    }
788545
public function set(string $key, $value, int $ttl = null): void
    {
        $keyMD5 = md5($key);
        $key = $this->keyPrefix . substr($keyMD5, 0, 3) . '/' . substr($keyMD5, 3) . '.2';
        $this->dataRepository->setValue($key, gzcompress(serialize([$ttl > 0 ? time() + $ttl : 0, $value])));
    }
658878
public function put($key, $value, $duration, $localOnly = false)
    {
        $cacheKey = $this->cacheKey($key);
        if($this->keepLocalCache)
            $this->localCache[$cacheKey] = $value;
        if(!$localOnly)
            $this->cacheStore->put($cacheKey, $value, $duration);
    }
397509
public function addCacheTag($key, $value)
    {
        if ($this->runtimeContentCache->getEnableContentCache() === false) {
            return;
        }
        $this->runtimeContentCache->addTag($key, $value);
    }