Get the timestamp from the cache or fill the cache
    Much quicker than reading the same files over and over
347268
def _get_timestamp_cached(dirname_full, remove):
    
    if dirname_full not in TIMESTAMP_CACHE:
        mtime = _get_timestamp(dirname_full, remove)
        TIMESTAMP_CACHE[dirname_full] = mtime
    return TIMESTAMP_CACHE[dirname_full]
17589
function _cacheData(key, value) {
    cache[key] = { timeStamp: _getTimeStamp(), value: value };
    _deletePromiseWaiting(key);
    return value;
}
66490
def get_cached(path, cache_name=None, **kwargs):
    
    if gw2api.cache_dir and gw2api.cache_time and cache_name is not False:
        if cache_name is None:
            cache_name = path
        cache_file = os.path.join(gw2api.cache_dir, cache_name)
        if mtime(cache_file) >= time.time() - gw2api.cache_time:
            with open(cache_file, "r") as fp:
                return json.load(fp)
    else:
        cache_file = None

    r = gw2api.session.get(gw2api.BASE_URL + path, **kwargs)

    if not r.ok:
        try:
            response = r.json()
        except ValueError:  # pragma: no cover
            response = None
        if isinstance(response, dict) and "text" in response:
            r.reason = response["text"]

    r.raise_for_status()
    data = r.json()

    if cache_file:
        with open(cache_file, "w") as fp:
            json.dump(data, fp, indent=2)

    return data
1018346
def updated(bank, key, cachedir):
    '''
    
    '''
    key_file = os.path.join(cachedir, os.path.normpath(bank), '{0}.p'.format(key))
    if not os.path.isfile(key_file):
        log.warning('Cache file "%s" does not exist', key_file)
        return None
    try:
        return int(os.path.getmtime(key_file))
    except IOError as exc:
        raise SaltCacheError(
            'There was an error reading the mtime for "{0}": {1}'.format(
                key_file, exc
            )
        )
1019715
def _loadcache(cachefile):
    
    cache = {}
    if os.path.exists(cachefile):
        with open(cachefile) as f:
            for line in f:
                line = line.split()
                if len(line) == 2:
                    try:
                        cache[int(line[0])] = float(line[1])
                    except:
                        pass
    return cache
411957
def _scrub_generated_timestamps(self, target_workdir):
    """"""
    for root, _, filenames in safe_walk(target_workdir):
      for filename in filenames:
        source = os.path.join(root, filename)

        with open(source, 'r') as f:
          lines = f.readlines()
        if len(lines) < 1:
          return
        with open(source, 'w') as f:
          if not self._COMMENT_WITH_TIMESTAMP_RE.match(lines[0]):
            f.write(lines[0])
          for line in lines[1:]:
            f.write(line)
467155
public Timestamp getOrAddToCache(Timestamp newValue, boolean hard)
    {
        if (newValue == null || newValue instanceof CachedImmutableTimestamp || newValue == NullDataTimestamp.getInstance())
        {
            return newValue;
        }
        return (Timestamp) weakPool.getIfAbsentPut(newValue, hard);
    }
804412
def cache_get(key):
    
    packed = cache.get(_hashed_key(key))
    if packed is None:
        return None
    value, refresh_time, refreshed = packed
    if (time() > refresh_time) and not refreshed:
        cache_set(key, value, settings.CACHE_SET_DELAY_SECONDS, True)
        return None
    return value
124755
def _cache_get(self, date):
        
        if date in self.cache_data:
            logger.debug('Using class-cached data for date %s',
                         date.strftime('%Y-%m-%d'))
            return self.cache_data[date]
        logger.debug('Getting data from cache for date %s',
                     date.strftime('%Y-%m-%d'))
        data = self.cache.get(self.project_name, date)
        self.cache_data[date] = data
        return data
28255
def cache_file(filename, reload_on_change=False, opts=default_opts):
    """"""
    filename = pyc2py(filename)
    if filename in file_cache:
        if reload_on_change: checkcache(filename)
        pass
    else:
        opts['use_linecache_lines'] = True
        update_cache(filename, opts)
        pass
    if filename in file_cache:
        return file_cache[filename].path
    else: return None
    return
1208828
private long getLastTimeStamp(Path pathToCheck) {
    long lastTimeStamp = -1;
    long tmpTimeStamp = -1;
    try {
      for (FileStatus fileStat: fs.listStatus(pathToCheck)) {
        Path srcPath = fileStat.getPath();
        if (!fileStat.isDir()) {
          boolean checkFlag = true;
          if (release_pattern != null) {
            // just need to check the files that match the pattern
            Matcher m = release_pattern.matcher(srcPath.toString());
            if (!m.find()) {
              checkFlag = false;
            } 
          }
          if (checkFlag) {
            tmpTimeStamp = fileStat.getModificationTime();
          } else {
            continue;
          }
        } else {
          tmpTimeStamp = getLastTimeStamp(srcPath);
        }
        if (tmpTimeStamp > lastTimeStamp) {
          lastTimeStamp = tmpTimeStamp;
        }
      }
    } catch (IOException ioe) {
      LOG.error("IOException when checking timestamp ", ioe);
    }
    return lastTimeStamp;
  }
824677
public function getUsingFileTimestamps($key)
    {
        $value = $this->get($this->cacheKey($key));
        $timestamps = $this->get($this->cachetskey($key));

        if ($value !== false && $timestamps !== false) {

            foreach ($timestamps as $file => $timestamp) {

                if (filemtime($file) !== $timestamp)
                    return false;
            }

            return $value;
        }

        return false;
    }
348323
protected function _readTimestamp()
    {
        $data = array();
        if (empty($data) && file_exists($this->path . static::BUILD_TIME_FILE)) {
            $data = file_get_contents($this->path . static::BUILD_TIME_FILE);
            if ($data) {
                $data = unserialize($data);
            }
        }
        return $data;
    }
315457
def _get_timestamp(self):
        """"""
        filename_date = _find_date(os.path.basename(self._path))
        if filename_date:
            return filename_date
1262090
function(file) {
    if (!AST.cache) {
      return;
    }
    else if (typeof file === 'string') {
      if (!AST.cache[file]) AST.cache[file] = null;
    }
    else if (file.isParsed() && !file.timestamp) {
      file.timestamp = Date.now();
      AST.cache[file.file] = file;
    }
  }
481667
def get_timestamp(self, **kwargs):
        """"""
        timestamp = kwargs.get('timestamp')
        if not timestamp:
            now = datetime.datetime.utcnow()
            timestamp = now.strftime("%Y-%m-%dT%H:%M:%S") + ".%03d" % (now.microsecond / 1000) + "Z"

        return timestamp
1238107
@SuppressWarnings("unchecked")
    public void loadCache() {
        if (!cacheManager.isNeedPersist()) {
            return;
        }
        File file = getSaveFile();
        if (null == file) {
            return;
        }
        if (!file.exists()) {
            return;
        }
        BufferedInputStream bis = null;
        try {
            FileInputStream fis = new FileInputStream(file);
            bis = new BufferedInputStream(fis);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte buf[] = new byte[1024];
            int len = -1;
            while ((len = bis.read(buf)) != -1) {
                baos.write(buf, 0, len);
            }
            byte retArr[] = baos.toByteArray();
            Object obj = getPersistSerializer().deserialize(retArr, null);
            if (null != obj && obj instanceof ConcurrentHashMap) {
                cacheManager.getCache().putAll((ConcurrentHashMap<String, Object>) obj);
            }
        } catch (Exception ex) {
            logger.error(ex.getMessage(), ex);
        } finally {
            if (null != bis) {
                try {
                    bis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }