Save the cache once the script terminates. Is attached as a shutdown
hook by calling Cache::setHook

@param string $cache_name Can be specified to save one specific cache
7463
public function saveCache(string $cache_name = null)
    {
        $cache_dir = $this->cache_path;
        $cnt = 0;
        foreach ($this->repository as $name => &$cache)
        {
            if ($cache_name !== null && $name !== $cache_name)
                continue;

            if (empty($cache['_changed']))
                continue;
            
            ++$cnt;
            unset($cache['_changed']);
            $cache_file = $cache_dir . '/' . $name . '.cache';
            file_put_contents($cache_file, serialize($cache));
            Hook::execute('Wedeto.IO.FileCreated', ['path' => $cache_file]);
        }
        return $cnt;
    }
608255
public function clear($name = null)
    {
        $cache = $this->_getSchemaCache();
        $tables = $cache->clear($name);

        foreach ($tables as $table) {
            $this->verbose(sprintf('Cleared "%s"', $table));
        }

        $this->out('<success>Cache clear complete</success>');

        return true;
    }
1365134
def save(self, cachedir=None, cfgstr=None, verbose=VERBOSE, quiet=QUIET,
             ignore_keys=None):
        
        fpath = self.get_fpath(cachedir, cfgstr=cfgstr)
        if verbose:
            print('[Cachable] cache save: %r' % (basename(fpath),))

        if hasattr(self, '__getstate__'):
            statedict = self.__getstate__()
        else:
            statedict = self.__dict__

        if ignore_keys is None:
            save_dict = statedict
        else:
            save_dict = {key: val
                         for (key, val) in six.iteritems(statedict)
                         if key not in ignore_keys}

        util_io.save_data(fpath, save_dict)
        return fpath
154101
public function saveAsScript(string $filename): void
    {
        $config = clone $this;
        unset($config->i__loader);

        $export = str_replace('stdClass::__set_state', '(object)', var_export($config, true));
        $script = "<?php\nreturn $export;";

        $success = file_put_contents($filename, $script, str_contains($filename, ':') ? 0 : LOCK_EX);

        if ($success && function_exists('opcache_compile_file')) {
            // @codeCoverageIgnoreStart
            opcache_compile_file($filename);
            // @codeCoverageIgnoreEnd
        }
    }
1263471
def cache(self, name='cache', default_timeout=3600):
        
        return Cache(self, name=name, default_timeout=default_timeout)
294730
public static function expires($cacheloc, $cachekey)
    {
        $cacheloc = "cache_" . $cacheloc;
        if ( isset($_SESSION[$cacheloc]) ) {
            $cache_row = $_SESSION[$cacheloc];
            if ( time() >= $cache_row[2] ) { 
                unset($_SESSION[$cacheloc]);
                return false;
            }
            if ( $cache_row[0] != $cachekey ) return false;
            if ( $cache_row[0] === false ) return false;
            return $cache_row[2] - time();
        }
        return false;
    }
3227
def save_cache(dpath, fname, cfgstr, data, ext='.cPkl', verbose=None):
    
    fpath = _args2_fpath(dpath, fname, cfgstr, ext)
    util_io.save_data(fpath, data, verbose=verbose)
    return fpath
1001929
public function my_reload($node_name)
    {
        if ($node_name == getNodeName()) {
            get_instance()->server->reload();
        } else {
            if (array_key_exists($node_name, $this->client)) {
                $this->client[$node_name]->reload();
            }
        }
    }
980334
public function checkDir($dir_name)
    {
        $this->file_reference_provider->loadReferenceCache();

        $this->checkDirWithConfig($dir_name, $this->config, true);

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Scanning files...' . "\n";
        }

        $this->config->initializePlugins($this);

        $this->codebase->scanFiles($this->threads);

        $this->config->visitStubFiles($this->codebase, $this->debug_output);

        if ($this->output_format === self::TYPE_CONSOLE) {
            echo 'Analyzing files...' . "\n";
        }

        $this->codebase->analyzer->analyzeFiles($this, $this->threads, $this->codebase->alter_code);
    }
182739
private function instanceCache($name)
    {
        self::$cache = new $name();
        self::$cache->connect($this->getConfig());
    }
1123347
public void setCache(String cacheName, String cacheKey, Object object) {
        Cache cache = cacheManager.getCache(cacheName);
        if (cache == null) {
            return;
        }
        cache.put(new Element(cacheKey, object));
    }
859559
public function delete_lock_instance($name) {
        if (!array_key_exists($name, $this->configlocks)) {
            throw new cache_exception('The requested store does not exist.');
        }
        if ($this->configlocks[$name]['default']) {
            throw new cache_exception('You can not delete the default lock.');
        }
        foreach ($this->configstores as $store) {
            if (isset($store['lock']) && $store['lock'] === $name) {
                throw new cache_exception('You cannot delete a cache lock that is being used by a store.');
            }
        }
        unset($this->configlocks[$name]);
        $this->config_save();
        return true;
    }
452409
protected static function _cacheQueryResult($cache_key, $value, $table_name = null, $connection_name = self::DEFAULT_CONNECTION)
        {
            if(isset(self::$_config[$connection_name]['cache_query_result']) && is_callable(self::$_config[$connection_name]['cache_query_result'])){
                return call_user_func_array(self::$_config[$connection_name]['cache_query_result'], array($cache_key, $value, $table_name, $connection_name));
            } elseif (!isset(self::$_query_cache[$connection_name])) {
                self::$_query_cache[$connection_name] = [];
            }

            self::$_query_cache[$connection_name][$cache_key] = $value;
        }
1201499
public function clearCacheByName($short_name)
    {
        $cid = $this->getCid($short_name);
        unset($this->schemaFiles[$short_name]);
        $this->clearCache($cid);
    }
1007641
public function setHook()
    {
        Hook::subscribe(Hook::SHUTDOWN_HOOK, [$this, 'saveCacheHook'], 10);

        foreach ($this->repository as $name => $cache)
            $this->checkExpiry($name);
    }
419977
public function save($table_name, $data) {

            // Insert
            if (empty($data['id'])) {
                return $this->insert($table_name, $data);
            } // Update
            else {
                $id = $data['id'];
                unset($data['id']);

                return $this->update($table_name, $id, $data);
            }
        }
104239
public function saveInCache($key, $value)
  {
    $this->deleteFromCache($key);
    $this->memcache->set($this->buildMKey($key), serialize($value));
  }