Sauvegarde une valeur dans le cache

@param string $key  Clé à sauvegarder
@param mixed $value Valeur à sauvegarder
323364
public function saveInCache($key, $value)
  {
    $this->deleteFromCache($key);
    $file = $this->cachePath . $this->getEncodedKey($key);
    file_put_contents($file, serialize($value), LOCK_EX);
  }
1355718
public function set($key, $value)
    {
        $setting = SettingModel::create(
            [
                'key' => $key,
                'value' => $value,
            ]
        );

        return $setting ? $value : false;
    }
373520
public function set(string $key, $value): Promise
    {
        return $this->client->xcache->set($key, serialize($value))->otherwise(function () {
            // Ignore
        });
    }
18183
public function set($key, $value)
    {
        $this->keys[$key] = true;
        $this->archive[$key] = $value;
    }
2126
private function cache(string $key, string $value, int $cacheTime = null)
    {
        try {
            $this->client->set($key, $value);

            if ($cacheTime !== null) {
                $this->client->expire($key, $cacheTime);
            }
        } catch (\Exception $e) {
            // We don't want exceptions in accessing the cache to break functionality.
            // The cache should be as transparent as possible.
            // If insight is needed into these exceptions,
            // a better way would be by notifying an observer with the errors.
        }
    }
702146
public function set($key, $value) {
		$this->validateValue($value);
		$this->variables[$key] = $value;
	}
804596
public static function set($key, $value)
    {
        putenv(vsprintf('%s=%s', [$key, $value]));
        $_ENV[$key] = $value;
        $_SERVER[$key] = $value;
    }
1144337
public function set( $key, $value )
    {
        $cache_file = new File($key.self::CACHE_FILE_EXT, $this->config->getCacheRoot());
    
        $expire = $this->config->getExpire();
        $expires = $expire > 0 ? time() + $this->config->getExpire() : 0;
        $data = base64_encode(serialize($value));
        
        $content[] = 'expires:' . $expires;
        $content[] = 'type:' . gettype($value);
        $content[] = 'class:' . (is_object($value) ? get_class($value) : '');
        $content[] = 'data:' . $data;
    
        $cache_file->putContents(implode("\n",$content));
    }
416432
protected function setCache($key, $value) {
        $this->cachedData = $this->resolveCacheComponent()->get($this->cacheKeyName);
        if (empty($this->cachedData))
            $this->cachedData = [];
        $this->cachedData[$key] = $value;
        return $this->resolveCacheComponent()->set($this->cacheKeyName, $this->cachedData, $this->cacheDuration);
    }
1126362
public function value($key, $value)
    {
        $this->values = array_merge($this->values ?? [], [$this->trimName($key) => $value]);
        return $this;
    }
301498
public function write($key, $value)
    {
        $key = $this->_key($key);
        $duration = $this->_config['duration'];

        return wincache_ucache_set($key, $value, $duration);
    }
1225329
public function addCacheControlDirective(string $key, $value = true)
    {
        $this->cacheControl[$key] = $value;
        $this->owner->getHeaders()->set('Cache-Control', $this->getCacheControlHeader());
    }
996373
public static function setVar($key, $value)
    {
        $var = new Vars($key);
        $var->key = $key;
        $var->value = $value;
        return $var->save();
    }
1081692
public function set($key, $value)
    {
        $method = 'setter' . ucfirst($key);
        if (method_exists($this, $method)) {
            $value = $this->$method($value);
        }
        $this->setRaw($key, $value);
    }
713522
protected function __storeData($key, $value = null)
    {
        if (property_exists($this, $key)) {
            $this->$key = $value;
        }
        else {
            parent::__storeData($key, $value);
        }
    }
1162148
public function set($key, $value)
    {
        $this->nestedKeyCache = [];

        if ($this->isNestedKey($key)) {
            $this->setNestedValueByKey($key, $value);

            return;
        }

        $this->items[$key] = $value;
    }
740681
public function setValueByKey($key, $value)
    {
        $model = Configuration::whereConfigurationKey($key)->first();

        if (null === $model) {
            return null;
        }
        $model->update(['configuration_value' => $value]);

        return $model;
    }