Package freemarker.cache

Examples of freemarker.cache.StrongCacheStorage


   
    private String renderWith(Version version, String mainBoolFmt, String incBoolFmt, String impBoolFtm)
            throws IOException, TemplateException {
        Configuration cfg = new Configuration(version);
        cfg.setTemplateLoader(TEMPLATES);
        cfg.setCacheStorage(new StrongCacheStorage());
        cfg.setBooleanFormat("C,c");
       
        if (incBoolFmt != null) {
            cfg.getTemplate(INCLUDED_FTL).setBooleanFormat(incBoolFmt);
        }
View Full Code Here


    public void testSetTemplateLoaderAndCache() throws Exception {
        Configuration cfg = new Configuration();
       
        CacheStorageWithGetSize cache = (CacheStorageWithGetSize) cfg.getCacheStorage();
        assertEquals(0, cache.getSize());
        cfg.setCacheStorage(new StrongCacheStorage());
        cache = (CacheStorageWithGetSize) cfg.getCacheStorage();
        assertEquals(0, cache.getSize());
       
        cfg.setClassForTemplateLoading(ConfigurationTest.class, "");
        assertEquals(0, cache.getSize());
View Full Code Here

    }

    public void testCachedException() throws Exception
    {
        MockTemplateLoader loader = new MockTemplateLoader();
        TemplateCache cache = new TemplateCache(loader, new StrongCacheStorage());
        cache.setDelay(1000L);
        loader.setThrowException(true);
        try
        {
            cache.getTemplate("t", Locale.getDefault(), "", true);
View Full Code Here

    }
   
    public void testCachedNotFound() throws Exception
    {
        MockTemplateLoader loader = new MockTemplateLoader();
        TemplateCache cache = new TemplateCache(loader, new StrongCacheStorage());
        cache.setDelay(1000L);
        cache.setLocalizedLookup(false);
        assertNull(cache.getTemplate("t", Locale.getDefault(), "", true));
        assertEquals(1, loader.getFindCount());
        assertNull(cache.getTemplate("t", Locale.getDefault(), "", true));
View Full Code Here

TOP

Related Classes of freemarker.cache.StrongCacheStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.