Build sets cache.
434409
def _build_cache():
    """"""
    sets = current_oaiserver.sets
    if sets is None:
        # build sets cache
        sets = current_oaiserver.sets = [
            oaiset.spec for oaiset in OAISet.query.filter(
                OAISet.search_pattern.is_(None)).all()]
    return sets
1256645
def write_cache(self):
        """"""
        doc = {
            '__format__': 1,
            'dependencies': self._cache,
        }
        with open(self._cache_file, 'w') as f:
            json.dump(doc, f, sort_keys=True)
819949
public T build(final boolean init) {
    final T cacheManager = newCacheManager(services, configBuilder.build());
    if(init) {
      cacheManager.init();
    }
    return cacheManager;
  }
1247563
def set(self, key, response):
        """"""
        mod = response.headers.pop('last-modified', None)
        status = int(response.status_code)
        rec = (key, status, mod, response.encoding, response.content,
               json.dumps(dict(response.headers)))
        with self._conn:
            self._conn.execute("DELETE FROM cache WHERE key=?", (key, ))
            self._conn.execute("INSERT INTO cache VALUES (?,?,?,?,?,?)", rec)
495981
def set(self, key, *args):
        """"""
        return self.cache.set(self._hashed(key), *args)
218418
protected function createAllCaches(): void
    {
        foreach (array_keys($this->cacheConfigurations) as $identifier) {
            if ($identifier !== 'Default' && !isset($this->caches[$identifier])) {
                $this->createCache($identifier);
            }
        }
    }
266226
protected function _buildCache()
    {
        $cacheTpl = "<?php\n\$source_version=%s;\n\$cache_version=%s;\n\$properties=%s;\n\$browsers=%s;\n\$userAgents=%s;\n\$patterns=%s;\n";

        $propertiesArray = $this->_array2string($this->_properties);
        $patternsArray = $this->_array2string($this->_patterns);
        $userAgentsArray = $this->_array2string($this->_userAgents);
        $browsersArray = $this->_array2string($this->_browsers);

        return sprintf(
            $cacheTpl,
            "'" . $this->_source_version . "'",
            "'" . self::CACHE_FILE_VERSION . "'",
            $propertiesArray,
            $browsersArray,
            $userAgentsArray,
            $patternsArray
        );
    }
663975
function cacheSet(key, options, val) {
    if (shouldCache(options)) {
      return;
    }

    if (self.options.cache === 'memory') {
      self.cache[key] = val;
      return;
    }

    self.options.cache.set(key, val);
  }
1358192
def sets(self, values):
        """"""
        # if cache server is configured, save sets list
        if self.cache:
            self.cache.set(self.app.config['OAISERVER_CACHE_KEY'], values)
1208323
public static function build()
    {
        switch (true) {
            // @codeCoverageIgnoreStart
            case extension_loaded('apc'):
                $cacheDriver = new ApcuCache;
                break;

            case extension_loaded('xcache'):
                $cacheDriver = new XcacheCache;
                break;

            case extension_loaded('memcache'):
                $memcache = new \Memcache;
                $memcache->connect('127.0.0.1');

                $cacheDriver = new MemcacheCache;
                $cacheDriver->setMemcache($memcache);
                break;

            case extension_loaded('redis'):
                $redis = new \Redis();
                $redis->connect('127.0.0.1');

                $cacheDriver = new RedisCache;
                $cacheDriver->setRedis($redis);
                break;
            // @codeCoverageIgnoreEnd

            default:
                $cacheDriver = new ArrayCache;
        }

        return $cacheDriver;
    }
1281629
public function rebuildCache()
    {
        $themes = $this->scanJsonFiles();
        // file_put_contents($this->cachePath, json_encode($themes, JSON_PRETTY_PRINT));

        $stub = file_get_contents(__DIR__ . '/stubs/cache.stub');
        $contents = str_replace('[CACHE]', var_export($themes, true), $stub);
        file_put_contents($this->cachePath, $contents);
    }
610049
def set_cache(self, value):
        
        value.update(self.cache)
        return self.cache_backend.set(self.cache_key, value)
387178
def _init_cache(self):
        """"""
        self._add_cache = defaultdict(list)
        self._reverse_add_cache = defaultdict(list)
        self._undefined_cache = {}
        self._remove_cache = {}
1253908
public static CacheConfiguration build() throws IOException {
		File file = new File(ClassLoaderUtils.getResourcePath("") + "cache.properties");
		return build(file);
	}
489786
private function bootCacher()
    {
        /** @var Cacher $cacher */
        $cacher = Cacher::getInstance();

        // Default cacher if FileCache, so we do not check it
        if (MemcachedCache::itWorks()) { // Distributed cache new version
            $cacher->setDefaultCacher('MemcachedCache');
        } elseif (MemcacheCache::itWorks()) { // Distributed cache old version
            $cacher->setDefaultCacher('MemcacheCache');
        } elseif (RedisCache::itWorks()) { // No-sql database
            $cacher->setDefaultCacher('RedisCache');
        }
    }
310979
def _save_cache(self):
        """"""
        if not self._disable_cache:
            UTILS.save_cache(self._cache, self._cache_path)
1285569
public function cacheFixtures()
    {
        $this->init();

        $this->migrations = $this->fetchMigrations();
        $this->fixtures   = $this->fetchFixtures();

        if ($this->useBackup && ! $this->hasBackup()) {
            $this->dropDatabase();
        }
    }