Returns a CacheEntry instance for File.
336238
def cache_entry(self):
        
        if self.storage_path is None:
            raise ValueError('This file is temporary and so a lal '
                             'cache entry cannot be made')

        file_url = urlparse.urlunparse(['file', 'localhost', self.storage_path, None,
                                            None, None])
        cache_entry = lal.utils.CacheEntry(self.ifo_string,
                   self.tagged_description, self.segment_list.extent(), file_url)
        cache_entry.workflow_file = self
        return cache_entry
659388
static RegistryEntry getEntry(VirtualFile virtualFile) {
        if (virtualFile == null) {
            throw MESSAGES.nullArgument("VirutalFile");
        }
        return rootEntry.find(virtualFile);
    }
1141899
@Override
    protected T readCacheDataFromFile(File file) throws CacheLoadingException {
        try {
            JsonParser jsonParser = jsonFactory.createJsonParser(new FileReader(file));
            T result = jsonParser.parse(getHandledClass(), null);
            jsonParser.close();
            return result;
        } catch (FileNotFoundException e) {
            // Should not occur (we test before if file exists)
            // Do not throw, file is not cached
            Ln.w("file " + file.getAbsolutePath() + " does not exists", e);
            return null;
        } catch (Exception e) {
            throw new CacheLoadingException(e);
        }
    }
771893
@Override
    public String getCacheEntry(String cacheInstance, String cacheId) throws javax.management.AttributeNotFoundException { // 429429       

        if (cacheId == null) {
            throw new AttributeNotFoundException(cacheId + " is null.");
        }

        //Get the cache for this cacheInstance
        DCache cache1 = getCache(cacheInstance);
        //Get the cache entry

        EntryInfo ei = new EntryInfo();
        ei.setId(cacheId);
        com.ibm.websphere.cache.CacheEntry cacheEntry = cache1.getEntry(ei, true);

        String stringEntry = null;
        if (null != cacheEntry) {
            stringEntry = cacheEntry.toString();
            // Release cacheEntry and decrement referenced count for it before
            // return.
            cacheEntry.finish();
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "getCacheEntry: Returning: " + stringEntry
                         + " for cacheInstance = " + cacheInstance);
        }

        return stringEntry;
    }
449056
public ZipEntry getEntry(String name) {
        if (name == null) {
            throw new NullPointerException("name");
        }
        long jzentry = 0;
        synchronized (this) {
            ensureOpen();
            jzentry = getEntry(jzfile, zc.getBytes(name), true);
            if (jzentry != 0) {
                ZipEntry ze = getZipEntry(name, jzentry);
                freeEntry(jzfile, jzentry);
                return ze;
            }
        }
        return null;
    }
1052552
function cacheFactory(internalCache) {

  // comparison cache will be use by getters
  //  since getters are persistent on the internal cache then the comparison cache also needs to be persistent
  var isTestedCache = {};

  /**
   * Get a pipeline 'deps' stage that populates cache for incremental compile.
   * Called on fully transformed row but only when there is no cache hit.
   * @param {object} depsCache The cache used by module-deps
   * @returns {stream.Through} a through stream
   */
  return function getCacheSession(depsCache) {

    // make getters for any existing values (cache is shared across instances)
    for (var key in internalCache) {
      defineGetterFor(depsCache, key);
    }

    // comparison cache needs to be reset every compile
    //  setting value is quicker than delete operation by an order of magnitude
    for (var key in isTestedCache) {
      isTestedCache[key] = false;
    }

    // deps stage transform
    function transform(row, encoding, done) {
      /* jshint validthis:true */
      var filename = row.file;
    
      var fileSource = null;
      try {
        fileSource = fs.readFileSync(filename).toString()
      } catch (e) {}

      if (fileSource !== null) {
        // populate the cache (overwrite)
        isTestedCache[filename] = false;
        internalCache[filename] = {
          input : fileSource,
          output: {
            id    : filename,
            source: row.source,
            deps  : merge({}, row.deps),
            file  : filename
          }
        };          
      }

      // ensure a getter is present for this key
      defineGetterFor(depsCache, filename);

      // complete
      this.push(row);
      done();
    }

    return through.obj(transform);
  };

  /**
   * Create getter on first appearance of a given key and operate through the persistent cache objects.
   * However be careful not to use any closed over variables in the getter.
   * @param {object} depsCache The browserify cache shared across instances
   * @param {string} filename The key (file name) for the deps cache
   */
  function defineGetterFor(depsCache, filename) {

    // instead of making the property re-definable we instead make assignment idempotent
    if (!depsCache.hasOwnProperty(filename)) {
      Object.defineProperty(depsCache, filename, {get: getter});
    }

    // create a getter
    //  we need to use a getter as it is the only hook at which we can perform comparison
    //  the value is accessed multiple times each compile cycle but is only set at the end of the cycle
    //  getters will persist for the life of the internal cache so the test cache also needs to persist
    function getter() {

      // not found
      var cached = internalCache[filename];
      if (!cached) {
        return undefined;
      }
      // we have already tested whether the cached value is valid and deleted it if not
      else if (isTestedCache[filename]) {
        return cached.output;
      }
      // test the input
      else {
        var isMatch = cached.input && fs.existsSync(filename) &&
          (cached.input === fs.readFileSync(filename).toString());
        isTestedCache[filename] = true;
        internalCache[filename] = isMatch && cached;
        return getter();
      }
    }
  }
}
1052527
def get_entry(self, entry_id):
        

        if entry_id in self._entries:
            return self._entries[entry_id]
        else:
            entry_offset = entry_id * self.entry_size

            # load entry
            entry = MftEntry(
                filename=self.filename,
                offset=self.offset + entry_offset,
                length=self.entry_size,
                index=entry_id
            )

            # cache entry
            self._entries[entry_id] = entry

            return entry
1130926
public CacheEntry readCacheEntry(Object id) { // SKS-O
        Result result = htod.readCacheEntry(id);
        if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
            stopOnError(result.diskException);
            this.htod.returnToResultPool(result);
            return null;
        }
        CacheEntry cacheEntry = (CacheEntry) result.data;
        this.htod.returnToResultPool(result);
        return cacheEntry;
    }
503914
def GetFileEntryByPathSpec(self, path_spec):
    
    return gzip_file_entry.GzipFileEntry(
        self._resolver_context, self, path_spec, is_root=True, is_virtual=True)
1291494
def _get_cache(vcf_fn, array_type, region, cachedir, compress, log):
    """"""

    # guard condition
    if isinstance(vcf_fn, (list, tuple)):
        raise Exception(
            'caching only supported when loading from a single VCF file'
        )

    # create cache file name
    cache_fn = _mk_cache_fn(vcf_fn, array_type=array_type, region=region,
                            cachedir=cachedir, compress=compress)

    # decide whether or not a fresh cache file is available
    # (if not, we will parse the VCF and build array from scratch)
    if not os.path.exists(cache_fn):
        log('no cache file found')
        is_cached = False
    elif os.path.getmtime(vcf_fn) > os.path.getmtime(cache_fn):
        is_cached = False
        log('cache file out of date')
    else:
        is_cached = True
        log('cache file available')

    return cache_fn, is_cached
976065
public void registerCachedFile(String name, DistributedCacheEntry entry) throws IOException {
		if (!this.cacheFile.containsKey(name)) {
			this.cacheFile.put(name, entry);
		} else {
			throw new IOException("cache file " + name + "already exists!");
		}
	}
1231416
protected function readCacheFile(string $cacheEntryPathAndFilename, int $offset = null, int $maxlen = null)
    {
        for ($i = 0; $i < 3; $i++) {
            $data = false;
            try {
                $file = fopen($cacheEntryPathAndFilename, 'rb');
                if ($file === false) {
                    continue;
                }
                if (flock($file, LOCK_SH) !== false) {
                    if ($offset !== null) {
                        fseek($file, $offset);
                    }
                    $data = fread($file, $maxlen !== null ? $maxlen : filesize($cacheEntryPathAndFilename) - (int)$offset);
                    flock($file, LOCK_UN);
                }
                fclose($file);
            } catch (\Exception $e) {
            }

            if ($data !== false) {
                return $data;
            }
            usleep(rand(10, 500));
        }

        return false;
    }
240794
function getCacheKey()
{
  // use the one from the context
  var directories = this.directories || this.defaults.directories;

  return resolveDir(directories)
    + ':'
    + getFiles.call(this, process.env).join(',')
    + ':'
    + resolveExts.call(this).join(',')
    ;
}
704273
def _read_cache(self):
        """"""
        if os.path.exists(self.filepath):
            with open(self.filepath, 'rt', encoding='utf8') as fh:
                lines = [x.strip() for x in fh]
        else:
            logger.debug("Index not found, starting empty")
            lines = []
        return lines
970194
def _cache_get_entry(self, entry_name, key=ENTIRE_ENTRY_KEY, default=False):
        
        if key is self.ENTIRE_ENTRY_KEY:
            return self._cache[entry_name]
        return self._cache[entry_name].get(key, default)
164335
def get(self, entry):
        """"""
        try:
            list = self.cache[entry.key]
            return list[list.index(entry)]
        except:
            return None
760206
def _load_cache(self):
        """"""
        # If the cached file exist, read-it
        max_refresh_date = timedelta(days=7)
        cached_data = {}
        try:
            with open(self.cache_file, 'rb') as f:
                cached_data = pickle.load(f)
        except Exception as e:
            logger.debug("Cannot read version from cache file: {} ({})".format(self.cache_file, e))
        else:
            logger.debug("Read version from cache file")
            if (cached_data['installed_version'] != self.installed_version() or
                    datetime.now() - cached_data['refresh_date'] > max_refresh_date):
                # Reset the cache if:
                # - the installed version is different
                # - the refresh_date is > max_refresh_date
                cached_data = {}
        return cached_data