Usage: dumpcache - display file hash cache
188595
def dumpcache(self):
		''' '''
		if cached.cacheloaded:
			#pprint.pprint(cached.cache)
			MyPrettyPrinter().pprint(cached.cache)
			return const.ENoError
		else:
			perr("Cache not loaded.")
			return const.ECacheNotLoaded
996668
def cache_index(index)
      # TODO: atomic rename. Right now we just hope.
      File.open(CACHE_PATH, 'w' ) do |out|
        YAML::dump( index, out )
      end
    end
186889
function cache_callback ( $output )
		{
			if ($hd = @fopen($this->cache_filename, 'w'))
			{
				fputs($hd,  $output);
				fclose($hd);
			}
			return $output;
		}
35082
private function _write_cache()
    {
        if (is_writable(dirname(dirname(dirname(__DIR__))).'/cache')) {
            @file_put_contents($this->_cache_file, $this->_use_json ?
                json_encode(array(
                    'hw' => array(
                        'pci' => $this->_pci_devices,
                        'usb' => $this->_usb_devices,
                    ),
                ))
                : serialize(array(
                    'hw' => array(
                        'pci' => $this->_pci_devices,
                        'usb' => $this->_usb_devices,
                    ),
            )));
        }
    }
299085
function emitCacheInformationFile (loader, query, cacheFile, fileHash, iconResult) {
  if (!query.persistentCache) {
    return;
  }
  loader.emitFile(cacheFile, JSON.stringify({
    hash: fileHash,
    version: pluginVersion,
    optionHash: generateHashForOptions(query),
    result: iconResult
  }));
}
619845
def cache_context(self, context):
        '''
        
        '''
        if not os.path.isdir(os.path.dirname(self.cache_path)):
            os.mkdir(os.path.dirname(self.cache_path))
        with salt.utils.files.fopen(self.cache_path, 'w+b') as cache:
            self.serial.dump(context, cache)
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)
406341
def cleancache(self):
		''' '''
		if os.path.exists(self.__hashcachepath):
			try:
				# backup first
				backup = self.__hashcachepath + '.lastclean'
				shutil.copy(self.__hashcachepath, backup)
				self.pd("Hash Cache file '{}' backed up as '{}".format(
					self.__hashcachepath, backup))
				cached.cleancache()
				return const.ENoError
			except Exception as ex:
				perr(formatex(ex))
				return const.EException
		else:
			return const.EFileNotFound
461653
function pc_dump() {

var hidden = 0;

	console.log('\n* Programme Cache:');
	for (var i in programme_cache) {
		var p = programme_cache[i];

		var present = giUtils.binarySearch(download_history,p.pid)>=0;

		var title = (p.title ? p.title : p.presentation_title);
		var parents = '';
		var ancestor_titles = '';
		for (var at in p.ancestor_titles) {
			present = present || (download_history.indexOf(p.ancestor_titles[at].pid)>=0);
			var t = '';
			if (p.ancestor_titles[at].title) {
				t = p.ancestor_titles[at].title;
			}
			else if (p.ancestor_titles[at].presentation_title) {
				t = p.ancestor_titles[at].presentation_title;
			}
			if (p.ancestor_titles[at].ancestor_type != 'episode') {
				ancestor_titles += t + ' : ';
			}
			else if (!title) {
				title = t;
			}
			parents += '  ' + p.ancestor_titles[at].pid + ' ('+t+') ';
		}
		title = ancestor_titles + title;
		if (p.version && p.version.pid) {
			parents += '  ' + p.version.pid + ' (vPID)';
		}

		var available = ((p.available_versions) && (p.available_versions.available > 0));

		if  ((!present && available) || (pidList.indexOf(p.pid)>=0) || showAll) {

			if (programme_cache.length==1) {
				debuglog(JSON.stringify(p,null,2));
			}

			var position = p.episode_of ? p.episode_of.position : 1;
			var totaleps = p.x_parent && p.x_parent.expected_child_count ? p.x_parent.expected_child_count : 1;
			var series = 1;

			console.log(p.pid+' '+pad(p.item_type,'       ',true)+' '+
				(p.media_type ? p.media_type : 'Audio')+' '+(available ? 'Available' : 'Unavailable')+'  '+green+title+normal);

			var len = (p.version && p.version.duration) ? p.version.duration : '0s';

			if (p.available_versions) {
				for (var v in p.available_versions.version) {
				    var version = p.available_versions.version[v];
					if (len == '0s') {
						len = version.duration;
					}
					parents += '  ' + version.pid + ' (vPID '+version.types.type[0]+')';
					for (var va in p.available_versions.version[v].availabilities) {
						var a = p.available_versions.version[v].availabilities[va];
						// dump mediasets
						if (dumpMediaSets) {
							for (var vaa in a) {
								var vaaa = a[vaa];
								for (var ms in vaaa.media_sets.media_set) {
									console.log(p.available_versions.version[v].pid+' '+vaaa.status+' '+vaaa.media_sets.media_set[ms].name);
								}
							}
						}
					}
				}
			}

			if (!len) len = '';
			len = len.replace('PT','').toLocaleLowerCase(); // ISO 8601 duration

			console.log('  '+len+' S'+pad(series,'00')+'E'+pad(position,'00')+
				'/'+pad(totaleps,'00')+' '+(p.synopses && p.synopses.short ? p.synopses.short : 'No description'));
			if (parents) console.log(parents);
			if (p.master_brand) {
				console.log('  '+p.master_brand.mid+' @ '+(p.release_date ? p.release_date :
					(p.release_year ? p.release_year : p.updated_time)));
			}

			if (p.contributions) {
				console.log();
				var contribution = toArray(p.contributions.contribution);
				for (var cont of contribution) {
					console.log((cont.character_name ? cont.character_name : (cont.credit_role ? cont.credit_role.$ : 'Unknown'))+' - '+
						(cont.contributor && cont.contributor.name ? (cont.contributor.name.given ? cont.contributor.name.given+' '+cont.contributor.name.family :
						cont.contributor.name.presentation) : 'Unknown'));
				}
			}

			//if (p.x_parent) {
			//	console.log(JSON.stringify(p.x_parent,null,2));
			//}

		}
		else {
			hidden++;
		}
	}

	if (programme_cache.length == 1) {
		var item = programme_cache[0];
		if (item.synopses && (item.synopses.long || item.synopses.medium)) {
			console.log();
			console.log(item.synopses.long ? item.synopses.long : item.synopses.medium);
		}
	}

	console.log();
	console.log('Cache has '+programme_cache.length+' entries, '+hidden+' hidden');
}
1126758
async function _handleFileInCache(filename, cache) {
  if (cache.get(filename) !== true) return cache.get(filename);
  return _addReadCallback(filename);
}
643790
def write_to_cache(self, data, filename):
        '''  '''

        json_data = json.dumps(data, sort_keys=True, indent=2)
        cache = open(filename, 'w')
        cache.write(json_data)
        cache.close()
181556
def dump(self, cache_file=None):
        """"""
        if cache_file is None:
            cache_file = self.cache_file
        if cache_file is not None:
            self.cache_file = cache_file
            with open(cache_file, 'wb') as pickle_fh:
                pickle.dump(
                    (self.remote, self.backend.name, self.max_sleep_interval,
                     self.job_id, self._status, self.epilogue, self.ssh,
                     self.scp),
                    pickle_fh)
839322
private void dumpCache(){
        if (CacheDumpLogger.isDebugEnabled()) {
            try {
                StringBuilder sb = new StringBuilder();
                sb.append("LookupManager dumped Service Cache at: ").append(System.currentTimeMillis()).append("\n");
                ModelService service = getData();
                sb.append(service==null ? "Cache is empty" : new String(serialize(service))).append("\n");
                CacheDumpLogger.debug(sb.toString());
            } catch (Exception e) {
                LOGGER.warn("Dump Service Cache failed. Set Logger {} to INFO to disable this message.",
                            CacheDumpLogger.getName());
                LOGGER.trace("Dump Service Cache failed. ", e);
            }
        }
    }
422997
def _dump_cache(self, _shifts):
        
        with open(self.__cache_path, 'wb') as f:
            dump(_shifts, f)
189940
def writeCache(self, filename):
        """"""
        with open(filename, 'wb') as f:
            pickle.dump(self.modules, f)
927414
private static void ensureCacheIndexLoaded() {
		if (cacheIndex == null) {
			cacheIndex = new HashMap<String, Boolean>();
			if (GlobalConfiguration.cleanCache) {
				deleteCacheFiles();
				anyNecessaryCacheCleanupDone = true;
			}
			else {
				File cacheDir = new File(GlobalConfiguration.cacheDir, ".slcache");
				cacheDir.mkdir();
				File cacheIndexFile = new File(cacheDir, ".index");
				if (cacheIndexFile.exists()) {
					try {
						boolean clearCache = false;
						int cacheVersion = CACHE_VERSION_1_1_0; // if no version tag, assume 1.1.0
						try {
							FileReader fr = new FileReader(cacheIndexFile);
							BufferedReader br = new BufferedReader(fr);
							String line;
							boolean handledVersionString = false;
							while ((line = br.readLine()) != null) {
								if (!handledVersionString) {
									if (line.startsWith("Version")) {
										int colon = line.indexOf(":");
										if (colon != -1) {
											cacheVersion = Integer.parseInt(line.substring(colon + 1));
										}

										handledVersionString = true;
										continue;
									}
								}
								StringTokenizer st = new StringTokenizer(line, ":");
								boolean changed = st.nextToken().equals("y");
								String len = st.nextToken();
								String classname = st.nextToken();
								String key = new StringBuilder(classname).append("_").append(len).toString();
								// System.out.println("Populating cache index:" + key + "=" + changed);
								cacheIndex.put(key, changed);
							}
							fr.close();
						}
						catch (IOException ioe) {
							ioe.printStackTrace();
						}
						if (cacheVersion != CURRENT_CACHE_VERSION) {
							clearCache = true;
							versionInIndex = false;
						}
						else {
							versionInIndex = true;
						}
						if (clearCache) {
							if (DEBUG_CACHING) {
								System.out.println("SpringLoaded: cache looks old (version " + cacheVersion
										+ ") - clearing it");
							}
							deleteCacheFiles();
							anyNecessaryCacheCleanupDone = true;
						}
					}
					catch (NoSuchElementException nsme) {
						// rogue entry in the cache
						if (DEBUG_CACHING) {
							System.out.println("SpringLoaded: cache corrupt, clearing it");
						}
						deleteCacheFiles();
						anyNecessaryCacheCleanupDone = true;
					}
				}
			}
		}
	}
543906
def hashit(*folders)
      htt = HashIt.new(options, folders)
      htt.create_hash_results
      dis = Display.new(options, htt.error_data, htt.file_data)
      dis.display_results()
    end