Performs a lookup for a template folder using the cache.
335812
def find_inheritable_template_folder_cached(view_context, name, partial, formats, param = nil)
      prefix = inheritable_cache_get(formats, name, partial, param)
      return prefix if prefix
      
      prefix = yield
      
      if prefix
        template = view_context.find_template_without_lookup(name, prefix, partial)
        inheritable_cache_set(template.formats, name, partial, param, prefix)
      end
      prefix
    end
191936
def scan_dir_for_template_files(search_dir):
    
    template_files = {}
    cf_dir = os.path.join(search_dir, 'cloudformation')
    for type in os.listdir(cf_dir):
        template_dir = os.path.join(cf_dir, type, 'templates')
        for x in os.listdir(template_dir):
            name = os.path.splitext(x)[0]
            template_files[name] = os.path.join(template_dir, x)
    return template_files
177655
static function storeCache( $key, $templateFilepath )
    {
        if ( !eZTemplateTreeCache::isCacheEnabled() )
            return false;
        $templateCache =& eZTemplateTreeCache::cacheTable();
        $key = eZTemplateTreeCache::internalKey( $key );
        if ( !isset( $templateCache[$key] ) )
        {
            eZDebug::writeDebug( "Template cache for key '$key' does not exist, cannot store cache", __METHOD__ );
            return;
        }
        $cacheFileName = eZTemplateTreeCache::treeCacheFilename( $key, $templateFilepath );

        $cache =& $templateCache[$key];

        $php = new eZPHPCreator( eZTemplateTreeCache::cacheDirectory(), $cacheFileName );
        $php->addVariable( 'eZTemplateTreeCacheCodeDate', eZTemplateTreeCache::CODE_DATE );
        $php->addSpace();
        $php->addVariable( 'TemplateInfo', $cache['info'] );
        $php->addSpace();
        $php->addVariable( 'TemplateRoot', $cache['root'] );
        $php->store( true );
    }
327300
public function warmUp($cacheDir)
    {
        if (null === $this->finder) {
            return;
        }

        $twig = $this->container->get('twig');

        $templates = $this->finder->findAllTemplates();

        foreach ($this->paths as $path => $namespace) {
            $templates = array_merge($templates, $this->findTemplatesInFolder($namespace, $path));
        }

        foreach ($templates as $template) {
            try {
                $twig->loadTemplate($template);
            } catch (Error $e) {
                // problem during compilation, give up
            }
        }
    }
289482
function(foundInCacheSeed, fullPath, data, compiled, next) {
            if (foundInCacheSeed) {
              debugLog("Found resource in cache seed: " + cacheUrl)
              if (data) {
                async.waterfall([
                  function(next) {
                    if (url.match(/\.css$/)) {
                      processStylesheet(rootUrl, version, url, data, timeout,
                        onCacheMiss, next);
                    } else {
                      next(null, data);
                    }
                  },
                ], function(err, data) {
                  if (err) return next(err);
                  writeToFile(filePath, data, function(err, fullPath) {
                    next(err, fullPath, data, compiled, null);
                  });
                });
              } else {
                next(null, fullPath, data, compiled, null);
              }
            } else {
              getServerResource(next);
            }
          }
176154
def load(self, name, skip='', skip_original='', default_template=None, layout=None):
        """"""
        filename = self.resolve_path(name, skip=skip, skip_original=skip_original,
                                     default_template=default_template)

        if not filename:
            raise ParseError("Can't find template %s." % name)

        with self.lock:
            if layout:
                _filename = filename + '$$' + layout
                mtime = os.path.getmtime(filename)
            else:
                mtime = None
                _filename = filename

            if self.cache:
                if not self.use_tmp:
                    #check current template file expiration
                    t = self.templates.get(_filename, mtime=mtime)
                    if t:
                        #check depends tempaltes expiration
                        check = self.check_expiration(t)
                        if not check:
                            return t
                else:
                    #get cached file from disk
                    pass
            t = self._create_template(name, filename, layout=layout)
            if self.cache:
                if not self.use_tmp:
                    self.templates.set(_filename, t, mtime)
                else:
                    #save cached file to disk
                    pass

            return t
71983
def get_template_sources(self, template_name, template_dirs=None):
        
        if not template_dirs:
            template_dirs = self.get_dirs()
        for template_dir in template_dirs:
            try:
                name = safe_join(template_dir, template_name)
            except SuspiciousFileOperation:
                # The joined path was located outside of this template_dir
                # (it might be inside another one, so this isn't fatal).
                pass
            else:
                if Origin:
                    yield Origin(
                        name=name,
                        template_name=template_name,
                        loader=self,
                    )
                else:
                    yield name
774049
def parse_template(app, filename):
    
    if not hasattr(parse_template, "cache"):
        parse_template.cache = {}
    if filename not in parse_template.cache:
        source = get_template_source(app, filename)
        parse_template.cache[filename] = app.jinja_env.parse(source, filename=filename)
    return parse_template.cache[filename]
1301937
def _ensure_dir(self, template_name):
        """"""
        head = os.path.dirname(template_name)
        if head:
            file_dirpath = os.path.join(self.outpath, head)
            if not os.path.exists(file_dirpath):
                os.makedirs(file_dirpath)
148383
def load_template_source(self, template_name, template_dirs=None):
        """"""
        #Get every app's folder
        log.error("Calling zip loader")
        for folder in app_template_dirs:
            if ".zip/" in folder.replace("\\", "/"):
                lib_file, relative_folder = get_zip_file_and_relative_path(folder)
                log.error(lib_file, relative_folder)
                try:
                    z = zipfile.ZipFile(lib_file)
                    log.error(relative_folder + template_name)
                    template_path_in_zip = os.path.join(relative_folder, template_name).replace("\\", "/")
                    source = z.read(template_path_in_zip)
                except (IOError, KeyError) as e:
                    import traceback
                    log.error(traceback.format_exc())
                    try:
                        z.close()
                    except:
                        pass
                    continue
                z.close()
                # We found a template, so return the source.
                template_path = "%s:%s" % (lib_file, template_path_in_zip)
                return (source, template_path)

        # If we reach here, the template couldn't be loaded
        raise TemplateDoesNotExist(template_name)
283220
private synchronized void initCache() {

    if (this.cache == null) {
      ClasspathFolder rootFolder = new ClasspathFolder(null, "");
      Set<String> resourceNames = this.reflectionUtil.findResourceNames("", true, ConstantFilter.getInstance(true));
      List<ClasspathFile> fileList = new ArrayList<>(resourceNames.size());
      for (String resource : resourceNames) {
        ResourcePathNode<Void> path = ResourcePathNode.create(resource);
        ClasspathFolder parent = createFolderRecursive(path.getParent(), rootFolder);
        ClasspathFile file = new ClasspathFile(parent, path.getName());
        parent.children.add(file);
        fileList.add(file);
      }
      this.cache = new Cache(rootFolder, fileList);
    }
  }
114482
def get_cache_item(self):
        ''''''
        if settings.DEBUG:
            raise AttributeError('Caching disabled in DEBUG mode')
        return getattr(self.template, self.options['template_cache_key'])
1347784
public static UriTemplate of(String template) {

		Assert.hasText(template, "Template must not be null or empty!");

		return CACHE.computeIfAbsent(template, UriTemplate::new);
	}
973751
def cache(cache_directory_path):
    """"""
    if not cache_directory_path:
        click.secho(dtool_config.utils.get_cache(
            CONFIG_PATH,
        ))
    else:
        click.secho(dtool_config.utils.set_cache(
            CONFIG_PATH,
            cache_directory_path
        ))
1144479
def find_name(self, template_name, search_dirs):
        
        file_name = self.make_file_name(template_name)

        return self._find_path_required(search_dirs, file_name)
1181729
function(path, contents) {
    // If template path is found in the cache, return the contents.
    if (path in this._cache && contents == null) {
      return this._cache[path];
    // Ensure path and contents aren't undefined.
    } else if (path != null && contents != null) {
      return this._cache[path] = contents;
    }

    // If the template is not in the cache, return undefined.
  }
1265888
def lookup(self, name):
        '''  '''
        if name not in self.cache or DEBUG:
            for path in self.path:
                fpath = os.path.join(path, name)
                if os.path.isfile(fpath):
                    if self.cachemode in ('all', 'found'):
                        self.cache[name] = fpath
                    return fpath
            if self.cachemode == 'all':
                self.cache[name] = None
        return self.cache[name]