Return a cache instance.
193726
def cache(self):
        """"""
        cache = self._cache or self.app.config.get('COLLECTIONS_CACHE')
        return import_string(cache) if isinstance(cache, six.string_types) \
            else cache
1227998
def get_from_cache(self):
        """"""
        for item in self.rule.output_files:
            dstpath = os.path.join(self.buildroot, item)
            self.linkorcopy(
                self.cachemgr.path_in_cache(item, self._metahash()),
                dstpath)
1342656
public static function getInstance(){
		if(!is_object(self::$instance)){
			if(DEBUG_CACHE){
				BLog::addToLog('[BCache]: Creating cache object ('.CACHE_TYPE.')...');
				}
			switch(CACHE_TYPE){
				case 'files':
					self::$instance=new \Brilliant\Cache\BCacheFiles();
					break;
				case 'memcache':
					bimport('cache.memcache');
					self::$instance=new \Brilliant\Cache\BCacheMemcache();
					break;
				case 'memcached':
					bimport('cache.memcached');
					self::$instance=new \Brilliant\Cache\BCacheMemcached();
					break;
				default:
					self::$instance=NULL;
					break;
				}
			}
		return self::$instance;
		}
588810
@Override
    public Cache getCache(String cacheName) throws CacheException
    {
        if (this.cache == null)
        {
            this.cache = createCache(cacheName);
        }

        return this.cache;
    }
257920
def factory(self, url):
        '''
        
        '''
        try:
            return self.fetch(url)
        except BaseException as exc:
            logger.exception('Reppy cache fetch error on %s' % url)
            return self.cache_policy.exception(url, exc)
233106
def memcache(self, f):
        """"""
        name = _fullname(f)
        cache = self.load_memcache(name)

        @wraps(f)
        def memcached(*args):
            """Cache the function in memory."""
            # The arguments need to be hashable. Much faster than using hash().
            h = args
            out = cache.get(h, None)
            if out is None:
                out = f(*args)
                cache[h] = out
            return out
        return memcached
1336012
def _get_cache(self):
        
        if not self._cache:
            self._cache = get_cache(self.app)
        return self._cache
581739
def get_instance(key, expire=None):
    """"""
    global _instances
    try:
        instance = _instances[key]
    except KeyError:
        instance = RedisSet(
            key,
            _redis,
            expire=expire
        )
        _instances[key] = instance

    return instance
1116663
public static IntArrayCache getInstance() {
		Application app = LCCore.getApplication();
		synchronized (IntArrayCache.class) {
			IntArrayCache instance = app.getInstance(IntArrayCache.class);
			if (instance != null)
				return instance;
			app.setInstance(IntArrayCache.class, instance = new IntArrayCache());
			return instance;
		}
	}
786181
public static ClassDescriptorCache getInstance() {
    if (INSTANCE == null) {
      synchronized (ClassDescriptorCache.class) {
        if (INSTANCE == null) {
          INSTANCE = new ClassDescriptorCache();
        }
      }
    }
    return INSTANCE;
  }
575086
def get(self, alias: str):
        
        try:
            return self._caches[alias]
        except KeyError:
            pass

        config = self.get_alias_config(alias)
        cache = _create_cache(**deepcopy(config))
        self._caches[alias] = cache
        return cache
374995
def factory(opts, **kwargs):
    '''
    
    '''
    if opts.get('memcache_expire_seconds', 0):
        cls = MemCache
    else:
        cls = Cache
    return cls(opts, **kwargs)
224108
def cache(self):
        
        if not self._cache:
            use_cache = getattr(settings, 'USE_DRF_INSTANCE_CACHE', True)
            if use_cache:
                from django.core.cache import cache
                self._cache = cache
        return self._cache
1115344
def get(self, key):
        """"""
        query = self._conn.execute("SELECT * FROM cache WHERE key=?", (key,))
        rec = query.fetchone()
        if rec is None:
            return None
        rec = dict(zip(self._columns, rec))

        if self.check_last_modified:
            if rec['modified'] is None:
                return None  # no last modified header present, so redownload

            head_resp = requests.head(key)
            new_lm = head_resp.headers.get('last-modified', None)
            if rec['modified'] != new_lm:
                return None

        resp = requests.Response()
        resp._content = rec['data']
        resp.status_code = rec['status']
        resp.encoding = rec['encoding']
        resp.headers = json.loads(rec['headers'])
        resp.url = key
        return resp
392377
def subcache(self, path):
        """"""

        cache = self.clone()
        cache.prefix = os.path.join(cache.prefix if cache.prefix else '', path)

        return cache
488962
public <TYPE> TYPE get(String key, Class<TYPE> type) {
		return cache.get(key, type);
	}
710297
def _cache_init(self):
        """"""
        cache_ = cache.get(self.CACHE_KEY)
        if cache_ is None:
            cache_ = defaultdict(dict)
        self._cache = cache_