Cache a given file for further use (by storing them on disk)
773580
def cache_file(file_name):
	

	remote_file_path = join(join(expanduser('~'), OCTOGRID_DIRECTORY), file_name)

	try:
		copyfile(file_name, remote_file_path)
	except Exception, e:
		raise e
862797
def readCache(self, filename):
        """"""
        with open(filename, 'rb') as f:
            self.modules = pickle.load(f)
923169
def store(self):
        '''
        
        '''
        if msgpack is None:
            log.error('Cache cannot be stored on disk: msgpack is missing')
        else:
            # TODO Dir hashing?
            try:
                with salt.utils.files.fopen(self._path, 'wb+') as fp_:
                    cache = {
                        "CacheDisk_data": self._dict,
                        "CacheDisk_cachetime": self._key_cache_time
                    }
                    msgpack.dump(cache, fp_, use_bin_type=True)
            except (IOError, OSError) as err:
                log.error('Error storing cache data to the disk: %s', err)
284357
function Filecache(options) {
  options = options || {};

  this.directory = options.directory || path.join(__dirname, '/.cache');
  this.fresh = +options.fresh || 500000;
}
768173
def set_disk_cache(self, results, key=None):
        """"""
        if not getattr(self, 'disk_cache_location', False):
            self.init_disk_cache()
        disk_cache = shelve.open(self.disk_cache_location)
        key = self.model.hash if key is None else key
        disk_cache[key] = results
        disk_cache.close()
233106
def memcache(self, f):
        """"""
        name = _fullname(f)
        cache = self.load_memcache(name)

        @wraps(f)
        def memcached(*args):
            """Cache the function in memory."""
            # The arguments need to be hashable. Much faster than using hash().
            h = args
            out = cache.get(h, None)
            if out is None:
                out = f(*args)
                cache[h] = out
            return out
        return memcached
644945
def _write_cache_to_file(self):
        """"""
        with(open(self._cache_file_name, 'w')) as fp:
            fp.write(simplejson.dumps(self._cache))
688527
def copy_file(self, from_path, to_path, replace=False):
        
        f = self.get_file(from_path)
        if f.copy(to_path, replace):
            self.set_cache_buster(to_path, f.hash())
329324
def _prepare_write_fs(read_fs, cache, read_path, readwrite_mode=True):
    '''
    
    '''

    with _get_write_fs() as write_fs:

        # If opening in read/write or append mode, make sure file data is
        # accessible
        if readwrite_mode:

            if not write_fs.isfile(read_path):
                _touch(write_fs, read_path)

                if read_fs.isfile(read_path):
                    fs.utils.copyfile(
                        read_fs, read_path, write_fs, read_path)

        else:
            _touch(write_fs, read_path)

        yield write_fs
53634
def cache_file(self, local_path, ip, path):
        
        destination = self.__destination(ip, path)
        atomicish_move(local_path, destination)
654747
def CacheFileObject(self, path_spec, file_object):
    
    self._file_object_cache.CacheObject(path_spec.comparable, file_object)
197034
def _tmpfile(self, cache_key, use):
    """"""
    with temporary_file(suffix=cache_key.id + use, root_dir=self._cache_root,
                        permissions=self._permissions) as tmpfile:
      yield tmpfile
1344415
def _save_cache(self, filename, section_number_of_pages, page_references):
        """"""
        cache_path = Path(filename).with_suffix(self.CACHE_EXTENSION)
        with cache_path.open('wb') as file:
            cache = (section_number_of_pages, page_references)
            pickle.dump(cache, file)
736131
def save_cache(cache):
    
    with open(settings.DUP_FILTER_FILE, "w") as f:
        f.write(
            json.dumps(list(cache))
        )
310979
def _save_cache(self):
        """"""
        if not self._disable_cache:
            UTILS.save_cache(self._cache, self._cache_path)
809116
def _fill_cache(self):
        """"""
        for irow in range(len(self._table)):
            file_handle = self._make_file_handle(irow)
            self._cache[file_handle.path] = file_handle
973751
def cache(cache_directory_path):
    """"""
    if not cache_directory_path:
        click.secho(dtool_config.utils.get_cache(
            CONFIG_PATH,
        ))
    else:
        click.secho(dtool_config.utils.set_cache(
            CONFIG_PATH,
            cache_directory_path
        ))