From: Steven Barth Date: Mon, 23 Jun 2008 23:03:38 +0000 (+0000) Subject: * libs/web: Changed caching behaviour of template library X-Git-Tag: 0.8.0~778 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd0eaf00057695e74c528757d0209a5d845a2c1b;p=oweals%2Fluci.git * libs/web: Changed caching behaviour of template library --- diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua index 29aedcdad..f7dcb5602 100644 --- a/libs/web/luasrc/template.lua +++ b/libs/web/luasrc/template.lua @@ -128,15 +128,12 @@ Template = luci.util.class() -- Shared template cache to store templates in to avoid unnecessary reloading Template.cache = {} +setmetatable(Template.cache, {__mode = "v"}) -- Constructor - Reads and compiles the template on-demand function Template.__init__(self, name) - if self.cache[name] then - self.template = self.cache[name] - else - self.template = nil - end + self.template = self.cache[name] -- Create a new namespace for this template self.viewns = {}