From: David ‘Bombe’ Roden Date: Wed, 19 Jan 2011 19:55:14 +0000 (+0100) Subject: Cache templates. X-Git-Tag: 0.4.2^2~25 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=bd0ef751727658dca8a4ee7f32b593306dd0ac83;p=Sone.git Cache templates. --- diff --git a/src/main/java/net/pterodactylus/sone/web/WebInterface.java b/src/main/java/net/pterodactylus/sone/web/WebInterface.java index 14c2c09..dbba1dd 100644 --- a/src/main/java/net/pterodactylus/sone/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/sone/web/WebInterface.java @@ -84,6 +84,12 @@ import net.pterodactylus.sone.web.ajax.UntrustAjaxPage; import net.pterodactylus.sone.web.page.PageToadlet; import net.pterodactylus.sone.web.page.PageToadletFactory; import net.pterodactylus.sone.web.page.StaticPage; +import net.pterodactylus.util.cache.Cache; +import net.pterodactylus.util.cache.CacheException; +import net.pterodactylus.util.cache.CacheItem; +import net.pterodactylus.util.cache.DefaultCacheItem; +import net.pterodactylus.util.cache.MemoryCache; +import net.pterodactylus.util.cache.ValueRetriever; import net.pterodactylus.util.logging.Logging; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.NotificationManager; @@ -768,12 +774,44 @@ public class WebInterface implements CoreListener { */ private class ClassPathTemplateProvider implements Provider { + /** Cache for templates. */ + private final Cache templateCache = new MemoryCache(new ValueRetriever() { + + @Override + @SuppressWarnings("synthetic-access") + public CacheItem