Cache module, update and install to file
354833
public function updateModule()
	{
		$this->moduleHandle->cacheModuleConfig();	//oke
		$this->moduleHandle->setModules();	//oke
		$this->moduleHandle->updateModuleAddon();
	}
314453
function putCache(key, contents, callback) {
    key = key.replace(/\//g, '-');
    var cacheFile = __dirname + '/' + CACHE_PREFIX + key + '.cache';

    fs.writeFile(cacheFile, contents, function (err) {
        if (err) {
            console.error('Error adding response to cache at ' + cacheFile);
            throw err;
        } else if (callback) {
            callback();
            return;
        }
    });
}
129322
def save_module(self, path, module, change_time=None):
        """"""
        #First, get a list of the module paths that have already been 
        #pickled. We will add to that list of pickling this module.
        if settings.use_filesystem_cache == False:
            return 

        self.__index = None
        try:
            files = self._index
        except KeyError:
            files = {}
            self._index = files

        target_path = self._get_hashed_path(path)
        with open(target_path, 'wb') as f:
            pickle.dump(module, f, pickle.HIGHEST_PROTOCOL)
            if change_time is None:
                files[path] = module[0].change_time
            else:
                files[path] = change_time

        #Save the list back to the disk
        self._flush_index()
939457
def update_cache(self, data):
        """"""
        UTILS.update(self._cache, data)
        self._save_cache()
63428
def generate_and_cache(path=user_path):
    '''
    
    '''
    data = tools.generate()
    if not path:
        return data
    try:
        directory = os.path.dirname(path)
        if not os.path.exists(directory):
            os.makedirs(directory)
        with open(path, 'wb') as f:
            pickle.dump((data_version, module_version, data), f)
    except (PermissionError, ValueError) as e:
        warnings.warn('Unable to write cache file "%s": %s' % (path, e))
    return data
1340292
function (module_name, module_folder) {
    var module_path = path.resolve(module_folder);

    // load current keystore
    let keystored = {};
    const filename = ".iotdb/keystore.json";
    _.cfg.load.json([ filename ], docd => keystored = _.d.compose.deep(keystored, docd.doc));

    // change it
    _.d.set(keystored, "/modules/" + module_name, module_path)

    // save it
    fs.writeFile(filename, JSON.stringify(keystored, null, 2));

    console.log("- installed homestar module!");
    console.log("  name:", module_name);
    console.log("  path:", module_path);
}
483188
function(request, modules_root, options){
        var [path, analysis] = normalize_path(request, modules_root, options.relative_path_root);
        var cache_path = path; // define cachepath as path to file with content. For modules, defines path to package.json
        if(analysis.is_a_module) cache_path = "module:" + cache_path; // since modules return package.json request, distinguish between module requests and actual requests to package.json
        return cache_path;
    }
969128
def install_update_deps(self):
        
        logger.debug("")
        self._ctx.installed(self.name)

        # are there any dependencies?
        depfile = os.path.join(self.repo_dir, '_upkg', 'depends')
        logger.debug("depfile? %s", depfile)
        if os.path.exists(depfile):
            logger.debug("Found depends file at %s", depfile)
            deps = open(depfile, 'r')
            dep = deps.readline()
            while dep:
                dep = dep.strip()
                logger.debug("depends: %s", dep)
                self._ctx.add_dep(nice_pkg_name(os.path.basename(dep)), dep)
                dep = deps.readline()
            deps.close()

        for rep in self._ctx.deps_needed:
            repo = Repo(url=rep)
            if repo.installed:
                repo.update()
            else:
                repo.install()
985624
def mock_file_cache(moduledir)
      mock_cache = MockFileCache.new(moduledir)
      allow(::BoltServer::FileCache).to receive(:new).and_return(mock_cache)
    end
265940
function reload(moduleName) {
    var id = require.resolve(moduleName);
    var mod = require.cache[id];
    if (mod) {
        var base = path.dirname(mod.filename);
        // expunge each module cache entry beneath this folder
        var stack = [mod];
        while (stack.length) {
            var mod = stack.pop();
            if (beneathBase(mod.filename)) {
                delete require.cache[mod.id];
            }
            stack.push.apply(stack, mod.children);
        }
    }

    // expunge each path cache entry beneath the folder
    for (var cacheKey in module.constructor._pathCache) {
        if (cacheKey.indexOf(moduleName) > 0 && beneathBase(cacheKey)) {
            delete module.constructor._pathCache[cacheKey];
        }
    }

    // re-require the module
    return require(moduleName);

    function beneathBase(file) {
        return base === undefined
            || (file.length > base.length
                && file.substr(0, base.length + 1) === base + path.sep);
    }
}
1040240
function addToCache(filename, obj) {
	if(cacheOn)
	{
		var x = cache[filename];
		if(!x)
			x = cache[filename] = {};
		x.mtime = obj.mtime || x.mtime;
		x.etag = obj.etag || x.etag;
		x.size = obj.size || x.size;
	}
}
226136
def apply_and_save(self):
        """"""
        patches = self.patches

        content = None
        with open(self.IN_PATH) as f_in:
            # As setup.py.in file size is 2.4 KByte.
            # it's fine to read entire content.
            content = f_in.read()

        # Replace words.
        for key in self.replaced_word_dict:
            content = content.replace(key, self.replaced_word_dict[key])

        # Apply patches.
        out_patches = []
        for patch in patches:
            pattern = re.compile(patch['src'], re.MULTILINE)
            (content, subs_num) = re.subn(pattern, patch['dest'],
                                          content)
            if subs_num > 0:
                patch['applied'] = True
            out_patches.append(patch)

        for patch in out_patches:
            if patch.get('required') and not patch.get('applied'):
                Log.warn('Patch not applied {0}'.format(patch['src']))

        with open(self.OUT_PATH, 'w') as f_out:
            f_out.write(content)

        self.pathces = out_patches
        # Release content data to make it released by GC quickly.
        content = None
196974
def _fill_cache(self, namespace):
        """"""

        modules = self._findPluginModules(namespace)

        self._cache = list(modules)
1015615
def _module_dir(handle):
  """"""
  cache_dir = resolver.tfhub_cache_dir(use_temp=True)
  return resolver.create_local_module_dir(
      cache_dir,
      hashlib.sha1(handle.encode("utf8")).hexdigest())
1306550
def cache_file(self, path, saltenv='base', cachedir=None, source_hash=None):
        '''
        
        '''
        return self.get_url(
            path, '', True, saltenv, cachedir=cachedir, source_hash=source_hash)
258733
def update_file_status(self):
        """"""
        nfiles = len(self.cache.keys())
        status_vect = np.zeros((6), int)
        sys.stdout.write("Updating status of %i files: " % nfiles)
        sys.stdout.flush()
        for i, key in enumerate(self.cache.keys()):
            if i % 200 == 0:
                sys.stdout.write('.')
                sys.stdout.flush()
            fhandle = self.cache[key]
            fhandle.check_status(self._base_path)
            fhandle.update_table_row(self._table, fhandle.key - 1)
            status_vect[fhandle.status] += 1

        sys.stdout.write("!\n")
        sys.stdout.flush()
        sys.stdout.write("Summary:\n")
        sys.stdout.write("  no_file:      %i\n" % status_vect[0])
        sys.stdout.write("  expected:     %i\n" % status_vect[1])
        sys.stdout.write("  exists:       %i\n" % status_vect[2])
        sys.stdout.write("  missing:      %i\n" % status_vect[3])
        sys.stdout.write("  superseded:   %i\n" % status_vect[4])
        sys.stdout.write("  temp_removed: %i\n" % status_vect[5])
1368636
def do_api_calls_update_cache(self):
        '''  '''
        zones = self.parse_env_zones()
        data = self.group_instances(zones)
        self.cache.write_to_cache(data)
        self.inventory = data