Set

@param string $cache_id
@param mixed $data
@param int $expire
@param array $tags
@return array
185258
public function set($cache_id, $data, $expire = null, $tags = []) {
		$result = $this->object->set($cache_id, $data, $expire, $tags);
		// if we are debugging
		if (\Debug::$debug) {
			\Debug::$data['cache'][] = array(
				'type' => 'set',
				'link' => $this->object->cache_link,
				'cache_id' => $cache_id,
				'have_data' => $result['success']
			);
			// todo: log errors
		}
		return $result;
	}
552600
public static function add( $key, $value, $expires )
	{
		$cache = self::instance();
		if ( $cache && $value != null) {
			$cache->set( $key, $value, $expires * 60 );
		}
	}
314171
public static function set($key, $data, $ttl = self::TTL_NO_EXPIRY, $tags = [])
    {
        if (!$cache = self::getInstance()) {
            return false;
        }

        $key = self::prepare($key);
        try {
            $item = $cache->getItem($key);
            $item->set($data);

            if (self::TTL_NO_EXPIRY !== $ttl) {
                $item->expiresAfter($ttl);
            }

            if (!empty($tags)) {
                $item->setTags($tags);
            }

            return $cache->save($item);
        } catch (InvalidArgumentException $e) {
            // something going wrong
            Logger::error($e->getMessage());
        }

        return false;
    }
544096
public static function add(string $key, $data, ?int $ttl = null, array $tags = []) :bool
        {
            if ($tags) {
                foreach ($tags as $arrKey => $tagName) {
                    unset($tags[$arrKey]);

                    $tags[$tagName] = self::tagGetVer($tagName);
                }
            }

            $ttl    = $ttl === null ? self::$ttlDefault : ($ttl > self::$ttlMax ? self::$ttlMax : $ttl);
            $expire = $ttl ? time() + $ttl : 0;

            return self::GetInstance()->add("\$vxnKey:{$key}",
                                            [
                                                '$_data'   => $data,
                                                '$_tags'   => $tags,
                                                '$_ttl'    => $ttl,
                                                '$_expire' => $expire,
                                            ],
                                            null,
                                            $expire);
        }
684569
public function set($key, $data, $expire = 0, $compress=false) {
		$expire = intval($expire);
		return $this->cache->set($this->prefix.$key, $data, $compress ? MEMCACHE_COMPRESSED : 0, $expire);
	}
186398
public function cache($context, string $key, $value = '', int $expire = 0)
    {
        if ($value === '') {
            $commandData = [$context, $key];
            $command = 'get';
        } else {
            if (!empty($expire)) {
                $command = 'setex';
                $commandData = [$context, $key, $expire, $value];
            } else {
                $command = 'set';
                $commandData = [$context, $key, $value];
            }
        }

        return $this->__call($command, $commandData);
    }
178473
public function cache($data, $view, $mergeData = null, $minutes = null, $key = null, $tag = null)
    {
        if (! $this->enabled) {
            return call_user_func($this->renderView($view, $data, $mergeData));
        }

        $viewKey = $this->getCacheKeyForView($view, $key);

        $mergeData = $mergeData ?: [];

        $tags = $this->getTags($tag);

        $minutes = $this->resolveCacheDuration($minutes);

        if ($this->cacheIsTaggable && $minutes === null) {
            return $this->cache
                ->tags($tags)
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        if ($this->cacheIsTaggable) {
            return $this->cache
                ->tags($tags)
                ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
        }

        if ($minutes === null) {
            return $this->cache
                ->rememberForever($viewKey, $this->renderView($view, $data, $mergeData));
        }

        return $this->cache
            ->remember($viewKey, $minutes, $this->renderView($view, $data, $mergeData));
    }
90006
public function add( $data, $stripTags = TRUE ){
		$id	= $this->table->insert( $data, $stripTags );
		$this->cache->set( $this->cacheKey.$id, $this->get( $id ) );
		return $id;
	}
898492
public function isCacheValid($id, $tag = null)
    {
        assert('is_string($id)');
        assert('is_null($tag) || is_string($tag)');

        $cacheFile = strval($this->cacheDirectory).'/'.$id;
        if (!file_exists($cacheFile)) {
            return false;
        }

        $expireFile = $cacheFile.'.expire';
        if (!file_exists($expireFile)) {
            return false;
        }

        $expireData = @file_get_contents($expireFile);
        if ($expireData === false) {
            return false;
        }

        $expireData = explode(':', $expireData, 2);

        $expireTime = intval($expireData[0]);
        if ($expireTime <= time()) {
            return false;
        }

        if (count($expireData) === 1) {
            $expireTag = null;
        } else {
            $expireTag = $expireData[1];
        }
        if ($expireTag !== $tag) {
            return false;
        }

        return true;
    }
1344811
public function cache($key, $expires = null) {
        if ($this->getType() !== self::SELECT) {
            return $this;
        }

        $this->_cacheKey = $key;
        $this->_cacheLength = $expires;

        return $this;
    }
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;
        }
    }
135286
protected function cacheData($key, $data, $config = [])
    {
        $this->cache->set($key, $data, $config['expire']);
    }
518190
public function set($key, $value, $expire = 0)
    {
        if ($this->type === 1) {
            return $this->memcache->set($key, $value, $expire);
        } else {
            return $this->memcache->set($this->conf['prefix'] . $key, json_encode($value, JSON_UNESCAPED_UNICODE), false, $expire);
        }
    }
863634
public function write($session_id, $session_data)
    {
        return $this->memcached->set($session_id, $session_data, $this->expire);
    }
1142011
public function store($key, $data, $expires = 0)
    {
        $new_data = [
            'time' => time(),
            'expire' => (int)$expires,
            'data' => serialize($data)
        ];
        if ($this->retrieve($key) !== null) {
            $this->delete($key);
        }
        $cache = $this->loadCache();
        if (is_array($cache)) {
            $cache[(string)$key] = $new_data;
        } else {
            $cache = [(string)$key => $new_data];
        }
        $this->saveCache($cache);
        return $this;
    }
267023
public function set($key, $value, $expiration = 300) {

		$files = glob(Path :: get('cache-shared') . $this -> generateName($key));

		if(count($files) > 0 && true === is_array($files)) {
			
			foreach($files as $file) {
				
				$file = new File($file);
				$file -> delete();
			}
		}

		$cache = new File(Path :: get('cache-shared') . $this -> generateName($key, intval($expiration)));
		$cache -> create() -> append(serialize($value));

		return $this;
	}
433114
public function set($key, $value = null, $expiration = 0)
    {
        if (empty($key)) return false;

        if (isset($this->list[$key])) {
            if (!$this->list[$key] == $value) return true;

            $this->list[$key]               = $value;
            $this->cacheListing[$key]->data = $value;
            $this->cacheListing[$key]->save();

            return true;
        }

        $this->list[$key] = $value;
        $entry            = new Entry();

        $entry->setKeyName($key);
        $entry->setKey($this->getRandomInt());

        $entry->setPermission(MemoryHandler::DEFAULT_PERMISSIONS);
        $entry->setMode(MemoryHandler::CREATE_MOD);
        $entry->setSize((int)MemoryHandler::DEFAULT_SIZE);
        $entry->setOffset((int)MemoryHandler::DEFAULT_OFFSET);
        $entry->setStart((int)0);
        $entry->setCount((int)0);
        $entry->setTtl((int)$expiration);
        $entry->setData($value);

        $entry->save();
        $this->cacheListing[$key] = $entry;

        return true;
    }