Adds ESI to the layout cache
422503
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
    {
        if (!$this->_getHelper()->isActive()) {
            return;
        }
        
        $updateModel = $observer->getLayout()->getUpdate();
        $handles = $updateModel->getHandles();
        $allowedEsi = $this->_getHelper()->getIsEsiAllowed();
        foreach ($handles as $handle) {
            if ($handle == 'customer_logged_in' 
                && !$this->_getHelper()->getIsInternal()) {
                $updateModel->removeHandle($handle);
                // Emulate always guest session
                $updateModel->addHandle('customer_logged_out');
            }
            
            if ($handle == 'default' && !$this->_getHelper()->getIsInternal()) {
                $updateModel->addHandle('default_varnish');
            }
            
            if ($allowedEsi && strtolower($handle) === $handle) {
                // Add handle only if handle is not starting from UPPERCASE code
                $updateModel->addHandle($handle . '_esi');
            }
        }
    }
551755
function _initialLayout(forceRefresh) {
        var panes = Object.keys(_panes),
            size = 100 / panes.length;

        _.forEach(_panes, function (pane) {
            if (pane.id === FIRST_PANE) {
                if (_orientation === VERTICAL) {
                    pane.$el.css({height: "100%",
                                  width: size + "%",
                                  float: "left"
                                 });
                } else {
                    pane.$el.css({ height: size + "%",
                                   width: "100%"
                                 });
                }
            } else {
                if (_orientation === VERTICAL) {
                    pane.$el.css({  height: "100%",
                                    width: "auto",
                                    float: "none"
                                 });
                } else {
                    pane.$el.css({ width: "100%",
                                   height: "50%"
                                 });
                }
            }

            _synchronizePaneSize(pane, forceRefresh);
        });
    }
85029
def add_entry(name, cache_entry)
      Puppet.debug {"Caching environment '#{name}' #{cache_entry.label}"}
      @cache[name] = cache_entry
      expires = cache_entry.expires
      @expirations.add(expires)
      if @next_expiration > expires
        @next_expiration = expires
      end
    end
77145
function getLayout(layout) {
    if (!layoutCache.hasOwnProperty(layout)) {
      var layoutContents = false,
          layoutPath = path.join(
        path.isAbsolute(options.layoutPath) ?
          options.layoutPath : path.join(process.cwd(), options.layoutPath),
        layout
      );
      try {
        layoutContents = fs.readFileSync(layoutPath, 'utf8');
      } catch (err) {
        throw new PluginError(logFlag, 'Could not read layout: \'' + layoutPath + '\'\n');
      }
      layoutCache[layout] = {
        contents: layoutContents,
        path: layoutPath
      };
    }
    return layoutCache[layout];
  }
982307
private void addToCache(BundleInfo bInfo) {
        List<Resource> info = _cacheBySymbolicName.get(bInfo.symbolicName);
        if (info == null) {
            info = new ArrayList<Resource>();
            info.add(bInfo);
        }

        info = _cacheBySymbolicName.putIfAbsent(bInfo.symbolicName, info);

        if (info != null) {
            synchronized (info) {
                info.add(bInfo);
            }
        }

        _bundleLocations.add(bInfo.file);
    }
1300315
private static void initCaches() {

        if (m_cacheTemporary == null) {
            m_cacheTemporary = CmsMemoryMonitor.createLRUCacheMap(1024);

            m_cachePermanent = new ConcurrentHashMap<String, byte[]>(32);

            m_cacheContentDefinitions = CmsMemoryMonitor.createLRUCacheMap(CONTENT_DEFINITION_CACHE_SIZE);
        }
        if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
            if ((OpenCms.getMemoryMonitor() != null)
                && !OpenCms.getMemoryMonitor().isMonitoring(CmsXmlEntityResolver.class.getName() + ".cacheTemporary")) {
                // reinitialize the caches after the memory monitor is set up
                Map<String, byte[]> cacheTemporary = CmsMemoryMonitor.createLRUCacheMap(128);
                cacheTemporary.putAll(m_cacheTemporary);
                m_cacheTemporary = cacheTemporary;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cacheTemporary",
                    cacheTemporary);

                Map<String, byte[]> cachePermanent = new ConcurrentHashMap<String, byte[]>(32);
                cachePermanent.putAll(m_cachePermanent);
                m_cachePermanent = cachePermanent;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cachePermanent",
                    cachePermanent);

                Map<String, CmsXmlContentDefinition> cacheContentDefinitions = CmsMemoryMonitor.createLRUCacheMap(
                    CONTENT_DEFINITION_CACHE_SIZE);
                cacheContentDefinitions.putAll(m_cacheContentDefinitions);
                m_cacheContentDefinitions = cacheContentDefinitions;
                OpenCms.getMemoryMonitor().register(
                    CmsXmlEntityResolver.class.getName() + ".cacheContentDefinitions",
                    cacheContentDefinitions);
            }
        }
    }
1357840
function compileFile(locals, cb) {
    getSourceTemplate(function(err, source, template) {
      if (err) return cb(err);

      // Try to get the layout
      parseLayout(source, filename, function(err, layoutTemplates) {
        if (err) return cb(err);

        function renderIt(layoutTemplates) {
          if (self._options.beautify) {
            return render(template, locals, layoutTemplates, function(err, html) {
              if (err) return cb(err);
              loadBeautify();
              return cb(null, self.beautify(html, self.beautifyrc));
            });
          }
          return render(template, locals, layoutTemplates, cb);
        }

        // Determine which layout to use

        if (typeof options.layout !== 'undefined' && !options.layout) {
          // If options.layout is falsy, behave as if no layout should be used - suppress defaults
          renderIt(null);
        } else if (layoutTemplates) {
          // 1. Layout specified in template
          renderIt(layoutTemplates);
        } else if (typeof options.layout !== 'undefined' && options.layout) {
          // 2. Layout specified by options from render
          var layoutFile = self.layoutPath(filename, options.layout);
          self.cacheLayout(layoutFile, options.cache, function(err, layoutTemplates) {
            if (err) return cb(err);
            renderIt(layoutTemplates);
          });
        } else if (self.defaultLayoutTemplates) {
          // 3. Default layout specified when middleware was configured.
          renderIt(self.defaultLayoutTemplates);
        } else {
          // render without a template
          renderIt(null);
        }
      });
    });
  }
868566
def apply_layout(env, content, opts)
      if layout = env['layout']
        layout.format = opts[:format]
        layout.content = content
        layout.template_name = opts[:layout] if layout.template_name?(opts[:layout], opts)
        layout
      else
        content
      end
    end
789012
function() {
		var me = this;

		if (core_plugins.notify(me, 'beforeLayout') === false) {
			return;
		}

		core_layouts.update(this, this.width, this.height);

		/**
		 * Provided for backward compatibility, use `afterLayout` instead.
		 * @method IPlugin#afterScaleUpdate
		 * @deprecated since version 2.5.0
		 * @todo remove at version 3
		 * @private
		 */
		core_plugins.notify(me, 'afterScaleUpdate');
		core_plugins.notify(me, 'afterLayout');
	}
121638
protected void initCacheObject() {

        CmsFlexController controller = (CmsFlexController)getJsp().getRequest().getAttribute(
            CmsFlexController.ATTRIBUTE_NAME);
        CmsFlexCache cache = controller.getCmsCache();

        setVariations("" + cache.size());
        setKeys("" + cache.keySize());
        CmsLruCache entryLruCache = cache.getEntryLruCache();

        if (entryLruCache != null) {
            Locale locale = getLocale();
            setMaxSize(CmsFileUtil.formatFilesize(entryLruCache.getMaxCacheCosts(), locale));
            setAvgSize(CmsFileUtil.formatFilesize(entryLruCache.getAvgCacheCosts(), locale));
            setCurSize(CmsFileUtil.formatFilesize(entryLruCache.getObjectCosts(), locale));
        }
    }
1001624
public void _doInclude(PageSource[] sources, boolean runOnce, Object cachedWithin) throws PageException {
	if (cachedWithin == null) {
	    _doInclude(sources, runOnce);
	    return;
	}

	// ignore call when runonce an it is not first call
	if (runOnce) {
	    Page currentPage = PageSourceImpl.loadPage(this, sources);
	    if (runOnce && includeOnce.contains(currentPage.getPageSource())) return;
	}

	// get cached data
	String cacheId = CacheHandlerCollectionImpl.createId(sources);
	CacheHandler cacheHandler = config.getCacheHandlerCollection(Config.CACHE_TYPE_INCLUDE, null).getInstanceMatchingObject(cachedWithin, null);

	if (cacheHandler instanceof CacheHandlerPro) {

	    CacheItem cacheItem = ((CacheHandlerPro) cacheHandler).get(this, cacheId, cachedWithin);

	    if (cacheItem instanceof IncludeCacheItem) {
		try {
		    write(((IncludeCacheItem) cacheItem).getOutput());
		    return;
		}
		catch (IOException e) {
		    throw Caster.toPageException(e);
		}
	    }
	}
	else if (cacheHandler != null) { // TODO this else block can be removed when all cache handlers implement CacheHandlerPro

	    CacheItem cacheItem = cacheHandler.get(this, cacheId);

	    if (cacheItem instanceof IncludeCacheItem) {
		try {
		    write(((IncludeCacheItem) cacheItem).getOutput());
		    return;
		}
		catch (IOException e) {
		    throw Caster.toPageException(e);
		}
	    }
	}

	// cached item not found, process and cache result if needed
	long start = System.nanoTime();
	BodyContent bc = pushBody();

	try {
	    _doInclude(sources, runOnce);
	    String out = bc.getString();

	    if (cacheHandler != null) {
		CacheItem cacheItem = new IncludeCacheItem(out, ArrayUtil.isEmpty(sources) ? null : sources[0], System.nanoTime() - start);
		cacheHandler.set(this, cacheId, cachedWithin, cacheItem);
		return;
	    }
	}
	finally {
	    BodyContentUtil.flushAndPop(this, bc);
	}
    }
141793
private static synchronized void addToCache(Cache cache, byte[] encoding,
            Object value) {
        if (encoding.length > ENC_MAX_LENGTH) {
            return;
        }
        Object key = new Cache.EqualByteArray(encoding);
        cache.put(key, value);
    }
785367
protected void putToCache(String cacheName, String key, Object value,
            long expireAfterWriteSeconds, long expireAfterAccessSeconds) {
        try {
            ICache cache = getCache(cacheName);
            if (value != null && cache != null) {
                cache.set(key, value, expireAfterWriteSeconds, expireAfterAccessSeconds);
            }
        } catch (CacheException e) {
            LOGGER.warn(e.getMessage(), e);
        }
    }
216860
function addSettings(cacheModule){
    cacheModule.nameSpace = settings.nameSpace;
    cacheModule.verbose = settings.verbose;
    return cacheModule;
  }
725953
function cacheAndCompile(filename, str) {
    var layout_template = handlebars.compile(str);
    if (options.cache) {
      cache[filename] = layout_template;
    }

    render_with_layout(layout_template, options, cb);
  }
41109
public static void addToCache(HttpServletRequest req, RequestProcessor s, WebApp app) {
        //Begin 253010  
        // check if cache is full
        if (_cacheSize.get() >= invocationCacheSize) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
            {
                logger.logp(Level.FINE, CLASS_NAME, "addToCache", "cache is full");
            }
            return;
        }

        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
        {
            logger.logp(Level.FINE, CLASS_NAME, "addToCache", "WebApp = " + app);
        }

        // PK80333 Start
        if (app.getDestroyed()) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
            {
                logger.logp(Level.FINE, CLASS_NAME, "addToCache", "Not caching as the webapp is destroyed");
            }
            return;
        }
        // PK80333 End

        StringBuilder cacheKey = (StringBuilder) cacheKeyStringBuilder.get();
        if (cacheKey == null) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
            {
                logger.logp(Level.FINE, CLASS_NAME, "addToCache", "cache key is null");
            }
            return;
        }
        String cacheKeyStr = cacheKey.toString();
        // Servlet 4.0 : Use CacheServletWrapperFactory
        CacheServletWrapper wrapper =  cacheServletWrapperFactory.createCacheServletWrapper((IServletWrapper) s, req, cacheKeyStr, app);
        if (_cacheMap.putIfAbsent(cacheKeyStr, wrapper) != null) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
            {
                logger.logp(Level.FINE, CLASS_NAME, "addToCache", "Already cached cacheKey --> " + cacheKey);
            }
        } else {
            ((IServletWrapper)s).addServletReferenceListener(wrapper);
            // keep a rough count of the number of items in the cache
            _cacheSize.incrementAndGet();
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15 
            {
                logger.logp(Level.FINE, CLASS_NAME, "addToCache", "Added to cache cacheKey --> " + cacheKey + " uri -->" + req.getRequestURI() + " servletWrapper -->"
                                                                      + ((IServletWrapper) s).getServletName());
            }
        }
        // End 253010
    }
368502
private void addEntryTableToLayout(
        List<CmsAccessControlEntry> entries,
        VerticalLayout layout,
        boolean editable,
        boolean inheritedRes) {

        final CmsPermissionViewTable table = new CmsPermissionViewTable(
            m_cms,
            entries,
            editable,
            inheritedRes,
            m_parents,
            this);
        HorizontalLayout hl = new HorizontalLayout();
        Label label = new Label(
            CmsVaadinUtils.getMessageText(
                Messages.GUI_PERMISSION_COUNT_1,
                new Integer(table.getContainerDataSource().size())));
        label.addStyleName("o-report");
        hl.addComponent(label);
        TextField tableFilter = new TextField();
        tableFilter.setIcon(FontOpenCms.FILTER);
        tableFilter.setInputPrompt(CmsVaadinUtils.getMessageText(org.opencms.ui.apps.Messages.GUI_EXPLORER_FILTER_0));
        tableFilter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
        tableFilter.setWidth("200px");
        tableFilter.addTextChangeListener(new TextChangeListener() {

            private static final long serialVersionUID = 1L;

            public void textChange(TextChangeEvent event) {

                table.filterTable(event.getText());
            }
        });
        hl.addComponent(tableFilter);
        hl.setWidth("100%");
        hl.setExpandRatio(label, 1);
        hl.setMargin(true);
        hl.setComponentAlignment(tableFilter, com.vaadin.ui.Alignment.MIDDLE_RIGHT);
        if (table.getContainerDataSource().size() == 0) {
            layout.addComponent(CmsVaadinUtils.getInfoLayout(Messages.GUI_PERMISSION_EMPTY_0));
        } else {
            layout.addComponent(hl);
            layout.addComponent(table);
            CmsVaadinUtils.centerWindow(this);
        }
    }