Reads in the cache fixture files to in-memory cache.
191639
def read_cache_fixtures!
      files = cache_files
      files.each do |file|
        cache_key = get_cache_key_from_filename(file)
        responses[cache_key] = Marshal.load(File.read(file))
      end
    end
862797
def readCache(self, filename):
        """"""
        with open(filename, 'rb') as f:
            self.modules = pickle.load(f)
754368
protected void loadCacheMapping() {
		File f = new File(getCacheFilePath());
		if (f.exists()) {
			try(InputStream is = new FileInputStream(f); BufferedReader rd = new BufferedReader(new FileReader(f))) {
				cacheProperties.load(is);
				for (Enumeration<?> properyNames = cacheProperties.propertyNames(); properyNames.hasMoreElements();) {
					String propName = (String) properyNames.nextElement();
					if (propName.startsWith(JAWR_MAPPING_PREFIX)) {

						String value = cacheProperties.getProperty(propName);

						String resourceMapping = propName.substring(JAWR_MAPPING_PREFIX.length());
						String[] mappings = value.split(SEMICOLON);
						List<FilePathMapping> fMappings = new CopyOnWriteArrayList<>();

						// TODO check the use of mappingModified
						boolean mappingModified = true;
						for (String fmapping : mappings) {
							String[] mapping = fmapping.split(MAPPING_TIMESTAMP_SEPARATOR);
							long lastModified = Long.parseLong(mapping[1]);
							String filePath = mapping[0];
							if (rsHandler.getLastModified(filePath) != lastModified) {
								mappingModified = false;
								break;
							}
							FilePathMapping fmap = new FilePathMapping(filePath, lastModified);
							fMappings.add(fmap);
						}

						if (mappingModified) {
							linkedResourceMap.put(resourceMapping, fMappings);
						}
					}
				}

			} catch (IOException e) {
				throw new BundlingProcessException("Unable to initialize " + getName() + " Generator cache", e);
			}
		}
	}
878279
def read_fixture_files(path)
        yaml_files = Dir["#{path}/{**,*}/*.yml"].select { |f|
          ::File.file?(f)
        } + [yaml_file_path(path)]

        yaml_files.each_with_object({}) do |file, fixtures|
          FixtureSet::File.open(file) do |fh|
            self.model_class ||= fh.model_class if fh.model_class
            fh.each do |fixture_name, row|
              fixtures[fixture_name] = ActiveRecord::Fixture.new(row, model_class)
            end
          end
        end
      end
272609
protected Reader retrieveFromCache(String path, GeneratorContext context, CacheMode cacheMode) {

		Reader rd = null;
		String filePath = getTempFilePath(context, cacheMode);
		
		FileInputStream fis = null;
		File file = new File(filePath);
		if (file.exists()) {
			try {
				fis = new FileInputStream(file);
			} catch (FileNotFoundException e) {
				throw new BundlingProcessException("An error occured while creating temporary resource for " + filePath,
						e);
			}
			FileChannel inchannel = fis.getChannel();
			rd = Channels.newReader(inchannel, context.getConfig().getResourceCharset().newDecoder(), -1);
			context.setRetrievedFromCache(true);
			if (LOGGER.isDebugEnabled()) {
				LOGGER.debug(getName() + " resource '" + path + "' retrieved from cache");
			}
		}
		return rd;
	}
1237381
@Read
    public Single<Map<String, Object>> getCaches() {
        return Flowable.fromIterable(cacheManager.getCacheNames())
                       .flatMapMaybe(n -> Flowable.fromPublisher(cacheManager.getCache(n).getCacheInfo()).firstElement())
                       .reduce(new HashMap<>(), (seed, info) -> {
                           seed.put(info.getName(), info.get());
                           return seed;
                       }).map(objectObjectHashMap -> Collections.singletonMap(
                           NAME, objectObjectHashMap
                       ));
    }
74313
def load_index_from_cache(self):
        '''  '''

        cache = open(self.cache_path_index, 'r')
        json_index = cache.read()
        self.index = json.loads(json_index)
1267914
def load_cache(self):
        """"""
        with open(self.cache_path, "rb") as f:
            print("Loading cached Zotero data...")
            cache = pickle.load(f)
            self._references = cache[self.CACHE_REFERENCE_LIST]
            self.reference_types = cache[self.CACHE_REFERENCE_TYPES]
            self.reference_templates = cache[self.CACHE_REFERENCE_TEMPLATES]
            print("Cached Zotero data loaded.")
548422
def generate_cache(self, resources=None, underlined=None,
                       task_handle=taskhandle.NullTaskHandle()):
        
        if resources is None:
            resources = self.project.get_python_files()
        job_set = task_handle.create_jobset(
            'Generatig autoimport cache', len(resources))
        for file in resources:
            job_set.started_job('Working on <%s>' % file.path)
            self.update_resource(file, underlined)
            job_set.finished_job()
1186386
def cache(self):
        """"""
        with open(self.cache_path, "wb") as f:
            cache = {self.CACHE_REFERENCE_LIST: self._references,
                     self.CACHE_REFERENCE_TYPES: self.reference_types,
                     self.CACHE_REFERENCE_TEMPLATES: self.reference_templates}
            pickle.dump(cache, f)
344510
def get_read_cache(self):
    
    if self._options.read_from and not self._read_cache:
      cache_spec = self._resolve(self._sanitize_cache_spec(self._options.read_from))
      if cache_spec:
        with self._cache_setup_lock:
          self._read_cache = self._do_create_artifact_cache(cache_spec, 'will read from')
    return self._read_cache
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
473029
def _load(self, files_in, files_out, urlpath, meta=True):
        """"""
        import dask
        out = []
        outnames = []
        for file_in, file_out in zip(files_in, files_out):
            cache_path = file_out.path
            outnames.append(cache_path)

            # If `_munge_path` did not find a match we want to avoid
            # writing to the urlpath.
            if cache_path == urlpath:
                continue

            if not os.path.isfile(cache_path):
                logger.debug("Caching file: {}".format(file_in.path))
                logger.debug("Original path: {}".format(urlpath))
                logger.debug("Cached at: {}".format(cache_path))
                if meta:
                    self._log_metadata(urlpath, file_in.path, cache_path)
                ddown = dask.delayed(_download)
                out.append(ddown(file_in, file_out, self.blocksize,
                                 self.output))
        dask.compute(*out)
        return outnames
368341
private void load() throws IOException
   {
      if (PrivilegedFileHelper.exists(storage))
      {
         InputStream in = PrivilegedFileHelper.fileInputStream(storage);
         try
         {
            Properties props = new Properties();
            log.debug("loading namespace mappings...");
            props.load(in);

            // read mappings from properties
            Iterator<Object> iter = props.keySet().iterator();
            while (iter.hasNext())
            {
               String prefix = (String)iter.next();
               String uri = props.getProperty(prefix);
               log.debug(prefix + " -> " + uri);
               prefixToURI.put(prefix, uri);
               uriToPrefix.put(uri, prefix);
            }
            prefixCount = props.size();
            log.debug("namespace mappings loaded.");
         }
         finally
         {
            in.close();
         }
      }
   }
136763
def from_dict(cls, d):
        """"""
        main_memory = MainMemory()
        caches = {}

        referred_caches = set()

        # First pass, create all named caches and collect references
        for name, conf in d.items():
            caches[name] = Cache(name=name,
                                 **{k: v for k, v in conf.items()
                                    if k not in ['store_to', 'load_from', 'victims_to']})
            if 'store_to' in conf:
                referred_caches.add(conf['store_to'])
            if 'load_from' in conf:
                referred_caches.add(conf['load_from'])
            if 'victims_to' in conf:
                referred_caches.add(conf['victims_to'])

        # Second pass, connect caches
        for name, conf in d.items():
            if 'store_to' in conf and conf['store_to'] is not None:
                caches[name].set_store_to(caches[conf['store_to']])
            if 'load_from' in conf and conf['load_from'] is not None:
                caches[name].set_load_from(caches[conf['load_from']])
            if 'victims_to' in conf and conf['victims_to'] is not None:
                caches[name].set_victims_to(caches[conf['victims_to']])

        # Find first level (not target of any load_from or store_to)
        first_level = set(d.keys()) - referred_caches
        assert len(first_level) == 1, "Unable to find first cache level."
        first_level = caches[list(first_level)[0]]

        # Find last level caches (has no load_from or store_to target)
        last_level_load = c = first_level
        while c is not None:
            last_level_load = c
            c = c.load_from
        assert last_level_load is not None, "Unable to find last cache level."
        last_level_store = c = first_level
        while c is not None:
            last_level_store = c
            c = c.store_to
        assert last_level_store is not None, "Unable to find last cache level."

        # Set main memory connections
        main_memory.load_to(last_level_load)
        main_memory.store_from(last_level_store)

        return cls(first_level, main_memory), caches, main_memory
1021068
private ReadResultEntry collectCachedEntries(long initialOffset, ReadResult readResult,
                                                 ArrayList<ReadResultEntryContents> cachedEntries) {
        long expectedOffset = initialOffset;
        while (readResult.hasNext()) {
            ReadResultEntry entry = readResult.next();
            if (entry.getType() == Cache) {
                Preconditions.checkState(entry.getStreamSegmentOffset() == expectedOffset,
                        "Data returned from read was not contiguous.");
                ReadResultEntryContents content = entry.getContent().getNow(null);
                expectedOffset += content.getLength();
                cachedEntries.add(content);
            } else {
                return entry;
            }
        }
        return null;
    }
1034715
protected synchronized void serializeCacheMapping() {
		for (Map.Entry<String, List<FilePathMapping>> entry : linkedResourceMap.entrySet()) {

			StringBuilder strb = new StringBuilder();
			Iterator<FilePathMapping> iter = entry.getValue().iterator();
			if (iter.hasNext()) {

				for (; iter.hasNext();) {
					FilePathMapping fMapping = iter.next();
					strb.append(fMapping.getPath()).append(MAPPING_TIMESTAMP_SEPARATOR)
							.append(fMapping.getLastModified());
					if (iter.hasNext()) {
						strb.append(SEMICOLON);
					}
				}
				cacheProperties.put(JAWR_MAPPING_PREFIX + entry.getKey(), strb.toString());
			}
		}

		File f = new File(getCacheFilePath());
		if (!f.getParentFile().exists()) {
			f.getParentFile().mkdirs();
		}
		FileWriter fw = null;
		try {
			fw = new FileWriter(f);
			cacheProperties.store(fw, "Cache properties of " + getName() + " generator");
		} catch (IOException e) {
			throw new BundlingProcessException("Unable to save cache file mapping ", e);
		} finally {
			IOUtils.close(fw);
		}
	}