Return a cache bucket for the given template.  All arguments are
        mandatory but filename may be `None`.
356771
def get_bucket(self, environment, name, filename, source):
        
        key = self.get_cache_key(name, filename)
        checksum = self.get_source_checksum(source)
        bucket = Bucket(environment, key, checksum)
        self.load_bytecode(bucket)
        return bucket
588997
private Bucket getCachedBucket(final String name) {
        Bucket cachedBucket = bucketCache.get(name);

        if(cachedBucket != null) {
            if (cachedBucket.isClosed()) {
                LOGGER.debug("Not returning cached bucket \"{}\", because it is closed.", name);
                bucketCache.remove(name);
            } else {
                LOGGER.debug("Returning still open, cached bucket \"{}\"", name);
                return cachedBucket;
            }
        }

        return null;
    }
78289
def cache(*args, **kwargs):
    
    ## only one argument ?
    if len(args) == 1 and len(kwargs) == 0 and \
           (callable(args[0]) or \
            isinstance(args[0], tuple(SUPPORTED_DECORATOR.keys()))):
        return _cache_w_args(args[0])
    return lambda f: _cache_w_args(f, *args, **kwargs)
162590
def _getCacheEntry(self, name):
        
        return next((x for x in self._uploadCache if x['name'] == name), None)
510901
function templateWithArgs( apiDir, apiName, apiFuncName ) {
	cacheAPIs[apiName] = { 
		reg: (RegularCacheClient
			.replace(/%%api.root%%/g,apiDir)
			.replace(/%%api.name%%/g,apiName)
			.replace(/%%api.funcs%%/g,JSON.stringify(apiFuncName))),
		service: (ServiceCacheClient
			.replace(/%%api.root%%/g,apiDir)
			.replace(/%%api.name%%/g,apiName)
			.replace(/%%api.funcs%%/g,JSON.stringify(apiFuncName)))
	}

}
515802
def load(self, name):
        

        if self.reload:
            self._maybe_purge_cache()

        template = self.cache.get(name)
        if template:
            return template

        path = self.resolve(name)
        if not path:
            raise OSError(errno.ENOENT, "File not found: %s" % name)

        with codecs.open(path, 'r', encoding='UTF-8') as f:
            contents = f.read()
            mtime = os.fstat(f.fileno()).st_mtime

        template = self.load_string(contents, filename=path)
        template.mtime = mtime
        template.path = path

        self.cache[name] = template
        return template
94628
def get_template(self, name):
        """"""
        filename = path.join(self.search_path, *[p for p in name.split('/')
                                                 if p and p[0] != '.'])
        if not path.exists(filename):
            raise TemplateNotFound(name)
        return Template.from_file(filename, self.encoding)
1217929
def get_template(name, base=None):
    '''
    '''
    # If the file doesn't exist, assume relative to base
    template_file = name
    if not os.path.exists(template_file):
        if base is None:
            base = get_templatedir()
        template_file = "%s/%s" %(base, name)

    # Then try again, if it still doesn't exist, bad name
    if os.path.exists(template_file):
        with open(template_file,"r") as filey:
            template = "".join(filey.readlines())
        return template
    bot.error("%s does not exist." %template_file)
53121
def getTemplate(self, uri, meta=None):
        """"""

        if not meta:

            metaKey = self.cacheKey + '_templatesmeta_cache_' + uri

            meta = cache.get(metaKey, None)

            if not meta:
                meta = self.getMeta(uri)
                cache.set(metaKey, meta, 15)

        if not meta:  # No meta, can return a template
            return None

        # Let's find the template in the cache
        action = urlparse(uri).path

        templateKey = self.cacheKey + '_templates_' + action + '_' + meta['template_tag']
        template = cache.get(templateKey, None)

        # Nothing found -> Retrieve it from the server and cache it
        if not template:

            r = self.doQuery('template/' + uri)

            if r.status_code == 200:  # Get the content if there is not problem. If there is, template will stay to None
                template = r.content

            cache.set(templateKey, template, None)  # None = Cache forever

        return template
823696
function cache(options, compiled) {
  // cachable
  if (compiled && options.filename && options.cache) {
    delete templates[options.filename];
    cacheStore[options.filename] = compiled;
    return compiled;
  }
  // check cache
  if (options.filename && options.cache) {
    return cacheStore[options.filename];
  }
  return compiled;
}
555750
def collect_by_typename(obj_sequence, cache=None):
    

    if cache is None:
        cache = {}

    for val in obj_sequence:
        key = type(val).__name__

        bucket = cache.get(key, None)
        if bucket is not None:
            bucket.append(val)
        else:
            cache[key] = [val]

    return cache
499569
def _read_buckets_cache_file(cache_file):
    '''
    
    '''

    log.debug('Reading buckets cache file')

    with salt.utils.files.fopen(cache_file, 'rb') as fp_:
        data = pickle.load(fp_)

    return data
288702
def get_template(path,
                 dest,
                 template='jinja',
                 saltenv='base',
                 makedirs=False,
                 **kwargs):
    '''
    
    '''
    if 'salt' not in kwargs:
        kwargs['salt'] = __salt__
    if 'pillar' not in kwargs:
        kwargs['pillar'] = __pillar__
    if 'grains' not in kwargs:
        kwargs['grains'] = __grains__
    if 'opts' not in kwargs:
        kwargs['opts'] = __opts__
    return _client().get_template(
            path,
            dest,
            template,
            makedirs,
            saltenv,
            **kwargs)
1043757
def get(self, prefix, url, schema_version=None):
        
        if not self.cache_dir:
            return None

        filename = self._get_cache_file(prefix, url)

        try:
            with open(filename, 'rb') as file:
                item = pickle.load(file)
            if schema_version and schema_version != item.schema:
                LOGGER.debug("Cache get %s %s: Wanted schema %d, got %d",
                             prefix, url,
                             schema_version, item.schema)
                return None
            return item
        except FileNotFoundError:
            pass
        except Exception:  # pylint:disable=broad-except
            _, msg, _ = sys.exc_info()
            LOGGER.warning("Cache get %s %s failed: %s", prefix, url, msg)

        return None
773990
def _get_template(self, template_name):
        
        if template_name not in self.chached_templates:
            self.chached_templates[template_name] = self.env.get_template(template_name)
        return self.chached_templates[template_name]
1132355
function loadTemplate (file, options) {
    // return cached template if caching enabled
    if (options.cache && GLOBAL.templates[file]) {
        return Promise.resolve(GLOBAL.templates[file])
    }
    // store promise to load template
    var promise = GLOBAL.templates[file] = fsp.readFile(file, 'utf8')
    // compile template file
    .then(data => {
        // replace entry in template cache with template function
        var template = GLOBAL.templates[file] = handlebars.compile(data)
        // resolve with template
        return template
    })
    // return promise
    return promise
}
291815
def path_in_cache(self, filename, metahash):
        
        cpath = self._genpath(filename, metahash)
        if os.path.exists(cpath):
            return cpath
        else:
            raise CacheMiss