Retrieve cache

 @param [Symbol] cache
   the cache to be used
433983
def [](cache)
      c = cache.to_sym

      fail Exceptions::CacheDoesNotExist, "Unknown cache \":#{c}\" given. Did you create it in advance?"  unless caches.key?(c)
      caches[c]
    end
644481
private User getFromCache(String userName)
   {
      return (User)cache.get(userName, CacheType.USER);
   }
602090
def _get_from_cache(self, expr):
        """"""
        is_cached, res = super()._get_from_cache(expr)
        if is_cached:
            indent_str = "    " * self._print_level
            return True, indent(res, indent_str)
        else:
            return False,  None
305429
def load_cache
      begin
        file = File.join("inline", File.basename(so_name))
        if require file then
          dir = Inline.directory
          warn "WAR\NING: #{dir} exists but is not being used" if test ?d, dir and $VERBOSE
          return true
        end
      rescue LoadError
      end
      return false
    end
1256548
def retrieve(self, request):
        
        if request.method not in CACHE_VERBS:
            return
        try:
            response = self.data[request.url]['response']
            logger.info('Retrieved response from cache')
            return response
        except KeyError:
            return None
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
516533
def cache(self):
        """"""
        if self._cache is None:
            self._cache = django_cache.get_cache(self.cache_name)
        return self._cache
391059
def cache_key(self, method_name):
        """"""
        key = ""
        method = getattr(self, "cache_key_{}".format(method_name), None)
        if method:
            key = method()

        return key
1224889
def check_cache(params)
      logger.verbose("TokenRequest checking cache #{@token_cache} for token.")
      result = @cache_driver.find(params)
      logger.info("#{result ? 'Found' : 'Did not find'} token in cache.")
      result
    end
1306268
def get_cache(self, request):
        

        # try and get the cached GET response
        cache_key = self.cache_key(request)
        cached_response = cache.get(cache_key, None)
        # if it wasn't found and we are looking for a HEAD, try looking for a corresponding GET
        if cached_response is None and request.method == 'HEAD':
            cache_key = self.cache_key(request, 'GET')
            cached_response = cache.get(cache_key, None)
        if cached_response is None:
            return None, None
        if cached_response[1] < time.time() - settings.BETTERCACHE_LOCAL_POSTCHECK:
            return cached_response[0], True
        return cached_response[0], False
642478
function extractFromCache ( cache ) {

			var values = [];
			for ( var key in cache ) {

				var data = cache[ key ];
				delete data.metadata;
				values.push( data );

			}
			return values;

		}
1084582
def info
      return @info if defined? @info

      # Try to fetch from cache first.
      key = HeapInfo::Cache.key_libc_info(name)
      @info = HeapInfo::Cache.read(key)
      @info ||= execute_libc_info.tap { |i| HeapInfo::Cache.write(key, i) }
    end
436069
private static synchronized Object getFromCache(Cache cache,
            byte[] encoding) {
        Object key = new Cache.EqualByteArray(encoding);
        Object value = cache.get(key);
        return value;
    }
220044
def cached(key, path_info, details, locals)
      name, prefix, partial = path_info

      if key
        @cache.cache(key, name, prefix, partial, locals) do
          yield
        end
      else
        yield
      end
    end
648944
def get_from_cache(url):
    
    # if the tool is configured to use the cache
    if settings.use_cache:
        # determine the filename by hashing the url
        filename = hashlib.md5(url.encode('utf-8')).hexdigest()

        cache_path_filename = os.path.join(settings.cache_folder, os.extsep.join([filename, 'json']))
        # open the cache file for this url hash if it already exists, otherwise
        # return None
        if os.path.isfile(cache_path_filename):
            with io.open(cache_path_filename, encoding='utf-8') as cache_file:
                response_json = json.load(cache_file)
            log('Retrieved response from cache file "{}" for URL "{}"'.format(cache_path_filename, url))
            return response_json
520171
def _get_from_cache(self, sector, scale, eft, basis):
        """"""
        try:
            return self._cache[eft][scale][basis][sector]
        except KeyError:
            return None
933570
def _load_from_cache_if_available(self, key):
    
    if key in self._cache:
      entity = self._cache[key]  # May be None, meaning "doesn't exist".
      if entity is None or entity._key == key:
        # If entity's key didn't change later, it is ok.
        # See issue 13.  http://goo.gl/jxjOP
        raise tasklets.Return(entity)