Retreives data from /private/cache
542798
public function fetch($key)
    {
        $file_name = $this->getFilePath($key);
        if (!\file_exists($file_name) || !\is_readable($file_name)) {
            return false;
        } else {
            $h = \fopen($file_name, 'r');
            //lock file
            \flock($h, LOCK_SH);
        }

        $data = \file_get_contents($file_name);

        //release lock
        \fclose($h);

        $data = @\unserialize($data);

        //check to see if it expired
        if ($data && ($data[0] == 0 || time() <= $data[0])) {
            return $data[1];
        } else {
            $this->delete($key);
            return false;
        }

        return $data[1];
    }
1083148
private DecoratedCache<K, V> findDecoratedCache(Cache<K, V> cache) {
      if (cache instanceof AbstractDelegatingCache) {
         if (cache instanceof DecoratedCache) {
            return ((DecoratedCache<K, V>) cache);
         }
         return findDecoratedCache(((AbstractDelegatingCache<K, V>) cache).getDelegate());
      }
      return null;
   }
966458
def get_cache(self, namespace, query_hash, length, start, end):
        """"""
        query = 'SELECT start, value FROM gauged_cache WHERE namespace = ? ' \
            'AND hash = ? AND length = ? AND start BETWEEN ? AND ?'
        cursor = self.cursor
        cursor.execute(query, (namespace, query_hash, length, start, end))
        return tuple(cursor.fetchall())
1312642
function loadUncached () {
    // execute original query
    return this.query.executeQuery()
    // cache result
    .then(results => {
        // cache results if there are any
        if (results.length > 0) {
            // cache results - do not wait to complete
            this.cacheResults(results)
        }
        // resolve with results
        return results
    })
}
289105
def retrieve(self, key):
        """"""
        column_file = os.path.join(self._hash_dir, '%s.json' % key)
        cache_file = os.path.join(self._hash_dir, '%s.npy' % key)

        if os.path.exists(cache_file):
            data = np.load(cache_file)
            if os.path.exists(column_file):
                with open(column_file, 'r') as json_file:
                    columns = json.load(json_file)
                data = pd.DataFrame(data, columns=columns)
        else:
            return None

        return data
505573
def cache_results(function):
    """"""
    def save_to_permacache():
        """Save the in-memory cache data to the permacache.

        There is a race condition here between two processes updating at the
        same time. It's perfectly acceptable to lose and/or corrupt the
        permacache information as each process's in-memory cache will remain
        in-tact.

        """
        update_from_permacache()
        try:
            with open(filename, 'wb') as fp:
                pickle.dump(cache, fp, pickle.HIGHEST_PROTOCOL)
        except IOError:
            pass  # Ignore permacache saving exceptions

    def update_from_permacache():
        """Attempt to update newer items from the permacache."""
        try:
            with open(filename, 'rb') as fp:
                permacache = pickle.load(fp)
        except Exception:  # TODO: Handle specific exceptions
            return  # It's okay if it cannot load
        for key, value in permacache.items():
            if key not in cache or value[0] > cache[key][0]:
                cache[key] = value

    cache = {}
    cache_expire_time = 3600
    try:
        filename = os.path.join(gettempdir(), 'update_checker_cache.pkl')
        update_from_permacache()
    except NotImplementedError:
        filename = None

    @wraps(function)
    def wrapped(obj, package_name, package_version, **extra_data):
        """Return cached results if available."""
        now = time.time()
        key = (package_name, package_version)
        if not obj.bypass_cache and key in cache:  # Check the in-memory cache
            cache_time, retval = cache[key]
            if now - cache_time < cache_expire_time:
                return retval
        retval = function(obj, package_name, package_version, **extra_data)
        cache[key] = now, retval
        if filename:
            save_to_permacache()
        return retval
    return wrapped
639887
private function retrievefromCache(){      
      
      if (class_exists('\\Cache'))
      {
        
        $cache_key = 'laravel-4-freegeoip-'. $this->ip;     

        if (\Cache::has($cache_key))
             $this->geoip_data = \Cache::get($cache_key);
          else
          {
              $this->geoip_data = $this->resolve($this->ip); 
              \Cache::put($cache_key, $this->geoip_data , 60*60);       
          }
      }
      else
           $this->geoip_data = $this->resolve($this->ip);
   }
1010636
def cache(number)
      number_file = File.join(@cache_dir, number + '.html')
      if File.exist?(number_file)
        @logger.info("Found cache at #{number_file}")
        return @agent.get("file://#{number_file}")
      end
      return nil
    end
980028
def cache(key, options = {}, &block) # :doc:
        if cache_configured?
          cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
        else
          yield
        end
      end
494987
def urlcache(url, cachesecs=24*60*60):
    ''
    p = Path(os.path.join(options.visidata_dir, 'cache', urllib.parse.quote(url, safe='')))
    if p.exists():
        secs = time.time() - p.stat().st_mtime
        if secs < cachesecs:
            return p

    if not p.parent.exists():
        os.makedirs(p.parent.resolve(), exist_ok=True)

    assert p.parent.is_dir(), p.parent

    req = urllib.request.Request(url, headers={'User-Agent': __version_info__})
    with urllib.request.urlopen(req) as fp:
        ret = fp.read().decode('utf-8').strip()
        with p.open_text(mode='w') as fpout:
            fpout.write(ret)

    return p
255609
function cache(source) {
    var _err = Nil
    var _value = Nil
    var _result = null
    var listeners = null

    return function continuable(callback) {
        if (_err !== Nil || _value !== Nil) {
            callback(_err, _value)
        } else if (listeners) {
            listeners.push(callback)
        } else {
            listeners = [callback]
            _result = source(function (err, value) {
                _err = err
                _value = value

                listeners.forEach(function (l) { l(err, value) })
            })
        }

        return _result
    }
}
1233049
def _Load(self,cached=True):
		""""""

		if not self.data or not cached:
			self.data = clc.v2.API.Call('GET','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id),
										session=self.session)

			# build ports
			self.data['_ports'] = self.data['ports']
			self.data['ports'] = []
			for port in self.data['_ports']:
				if 'portTo' in port:  self.ports.append(Port(self,port['protocol'],port['port'],port['portTo']))
				else:  self.ports.append(Port(self,port['protocol'],port['port']))

			# build source restriction
			self.data['_source_restrictions'] = self.data['sourceRestrictions']
			self.data['source_restrictions'] = []
			for source_restriction in self.data['_source_restrictions']:
				self.source_restrictions.append(SourceRestriction(self,source_restriction['cidr']))

		return(self.data)
563522
function decodeParams(cache, API_URL, params) {
  var obj = {}, v;
  for (var k in params) {
    if (!params.hasOwnProperty(k)) continue;
    obj[k] = decode(cache, API_URL, params[k]);
  }
  return obj;
}
242083
function listCacheGet(key) {
      var data = this.__data__,
          index = assocIndexOf(data, key);

      return index < 0 ? undefined$1 : data[index][1];
    }
181080
def from_cache(self, section, name):
        """"""
        cached_value = self.cache.get(
            self.get_cache_key(section, name), CachedValueNotFound)

        if cached_value is CachedValueNotFound:
            raise CachedValueNotFound

        if cached_value == preferences_settings.CACHE_NONE_VALUE:
            cached_value = None
        return self.registry.get(
            section=section, name=name).serializer.deserialize(cached_value)
806938
def fetch(self, crc):
        
        cache_data = None
        pattern = '%08X.json' % crc
        hit = None

        for name in self._cache_files:
            if (name.endswith(pattern)):
                hit = name

        if (hit):
            try:
                cache = open(hit)
                cache_data = json.load(cache,
                                       object_hook=self._decoder)
                cache.close()
            except Exception as exp:
                logger.warning('Error while parsing cache file [%s]:%s',
                               hit, str(exp))

        return cache_data
449739
function (key) {
      if (!supported) {
        try {
          return privateMethods.parseValue($cookieStore.get(key));
        } catch (e) {
          return null;
        }
      }
      var item = storage.getItem(key);
      return privateMethods.parseValue(item);
    }