Saves data in memcache

@param string $key
@param mixed $data
@param integer $ttl
@return boolean
330181
public function set($key, $data, $ttl = 3600)
    {
        if (!$this->requireProvider("Setting key " . $key)) return false;

        return $this->cacheProvider->set($key, $data, $ttl);
    }
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);
    }
207415
public function store($key, $data, $ttl=0){
        return apc_store($key, $this->preperaData($data), $ttl);
    }
1312855
public function store($key, $data, $ttl = 0) {
        return $this->store->store($this->realKey($key), $data, $ttl);
    }
336508
public function set($key, $value, $ttl)
    {
        return self::getCacheDriver()->set($key, $value, $ttl);
    }
546977
private function add_record($key, $data)
    {
        if ($this->type == 'memcache') {
            $result = $this->db->replace($key, $data, MEMCACHE_COMPRESSED, $this->ttl);

            if (!$result) {
                $result = $this->db->set($key, $data, MEMCACHE_COMPRESSED, $this->ttl);
            }
        }
        else if ($this->type == 'apc') {
            if (apc_exists($key)) {
                apc_delete($key);
            }

            $result = apc_store($key, $data, $this->ttl);
        }

        if ($this->debug) {
            $this->debug('set', $key, $data, $result);
        }

        return $result;
    }
1025485
public function put($key, $data)
    {

        $key = $this->getKeyCode($key);
        $data = json_encode($data);
        $this->memcacheObj->set($key, $data);
    }
98143
protected function writeData($key, $value, $ttl)
    {
        if (!is_numeric($ttl) || $ttl < 0)
            throw new CacheException('TTL invalid: '. $ttl);

        if ($ttl == 0)
            $expiration = "datetime('now', '+100 years')"; // This will make the cache expire after you die, so it's effectively forever.
        else
            $expiration = "datetime('now', '+{$ttl} seconds')";

        return $this->db->queryExec("INSERT OR REPLACE INTO cache (key, value, expire) VALUES ('" . $this->key($key) . "', '".
                                                                                        sqlite_escape_string($value) . "',".
                                                                                        "{$expiration})");
    }
802038
public function save($file, $data, $ttl)
	{
		$cacheHash = $this->getCacheHash($file);
		if($this->fs->write($this->getMetaFilePath($file), json_encode($data))) {
			if ($this->f3->get('CACHE')) {
				$cache = \Cache::instance();
				if ($ttl)
					$cache->set($cacheHash, $data, $ttl);
				elseif ($cache->exists($cacheHash))
					$cache->clear($cacheHash);
			}
			$this->data = $data;
			return true;
		} else return false;
	}
600771
public function set($key, $value, $ttl = self::DEFAULT_TTL)
    {
        if (!$this->hasConnection()) {
            // @codeCoverageIgnoreStart
            return false;
            // @codeCoverageIgnoreEnd
        }

        $flag = null;

        if (!is_bool($value) && !is_int($value) && !is_float($value)) {
            $flag = MEMCACHE_COMPRESSED;
        }

        try {
            return $this->memcache->set($key, $value, $flag, $ttl);
        // @codeCoverageIgnoreStart
        } catch (\Exception $e) {
        }

        return false;
        // @codeCoverageIgnoreEnd
    }
1059436
public function store($key, $var = null, $ttl = 0)
	{
		$ttl = ($ttl === 0) ? PHP_INT_MAX : time() + $ttl;

		$this->data[$key] = array($var, $ttl);

		return true;
	}
809051
function set($key,$val,$ttl=0) {
		$fw=Base::instance();
		if (!$this->dsn)
			return TRUE;
		$ndx=$this->prefix.'.'.$key;
		if ($cached=$this->exists($key))
			$ttl=$cached[1];
		$data=$fw->serialize([$val,microtime(TRUE),$ttl]);
		$parts=explode('=',$this->dsn,2);
		switch ($parts[0]) {
			case 'apc':
			case 'apcu':
				return call_user_func($parts[0].'_store',$ndx,$data,$ttl);
			case 'redis':
				return $this->ref->set($ndx,$data,$ttl?['ex'=>$ttl]:[]);
			case 'memcache':
				return memcache_set($this->ref,$ndx,$data,0,$ttl);
			case 'memcached':
				return $this->ref->set($ndx,$data,$ttl);
			case 'wincache':
				return wincache_ucache_set($ndx,$data,$ttl);
			case 'xcache':
				return xcache_set($ndx,$data,$ttl);
			case 'folder':
				return $fw->write($parts[1].
					str_replace(['/','\\'],'',$ndx),$data);
		}
		return FALSE;
	}
1124401
public function save($key, CacheEntry $data)
    {
        try {
            return wp_cache_set($key, serialize($data), $this->group, $data->getTTL());
        } catch (\Exception $ignored) {
            // Don't fail if we can't save it
        }

        return false;
    }
157803
public function save($id, $data, $ttl = 60, $raw = FALSE)
	{
		return wincache_ucache_set($id, $data, $ttl);
	}
258773
public function set($key, $value, $ttl = 0)
    {
        $ttl = $this->fromDefaultTtl($ttl);

        if ($ttl >= 0) {
            $this->memcached->set($key, $value);

            if ($ttl > 0) {
                $this->memcached->touch($key, \time() + $ttl);
            }

            $this->setChain($key, $value, $ttl);
        }

        return $this;
    }
298430
public function set($key, $value, $ttl = 0)
    {
        $key = $this->salted($key, $this->suffix);

        // handle deletions
        if ($value === null) {
            $this->cache->delete($key);
            return true;
        }

        // Resolve the TTL to use
        $ttl = $this->determineTTL($ttl);

        $this->cache->set($key, $value, $ttl);
        $code = $this->cache->getResultCode();

        if ($code === Memcached::RES_SUCCESS) {
            return true;
        }

        $this->sendAlert('set', $key, $code);
        return false;
    }
423923
public function store($key,$data,$ttl=0) {
        //Abro/Creo el archivo en modo lectura/escritura
        $file = fopen($this->getFileName($key),'a+');
        if(!$file){return FALSE;}
        //Consigo un bloqueo exclusivo
        flock($file,LOCK_EX);
        //Trunco el archivo en caso de que existieran datos viejos
        ftruncate($file,0);
        //Serializo los datos y los guardo con una fecha de expiracion , si es 0 se lo deja indefinidamente
        if($ttl != 0){
            $ttl= time() + $ttl;
        }
        $data = $this->preperaData(array($ttl,$data));
        if (fwrite($file,$data)===false) {return FALSE;}
        return fclose($file);
    }