* libs/web: Changed caching behaviour of template library
This commit is contained in:
parent
623eb26486
commit
cd0eaf0005
1 changed files with 2 additions and 5 deletions
|
@ -128,15 +128,12 @@ Template = luci.util.class()
|
||||||
|
|
||||||
-- Shared template cache to store templates in to avoid unnecessary reloading
|
-- Shared template cache to store templates in to avoid unnecessary reloading
|
||||||
Template.cache = {}
|
Template.cache = {}
|
||||||
|
setmetatable(Template.cache, {__mode = "v"})
|
||||||
|
|
||||||
|
|
||||||
-- Constructor - Reads and compiles the template on-demand
|
-- Constructor - Reads and compiles the template on-demand
|
||||||
function Template.__init__(self, name)
|
function Template.__init__(self, name)
|
||||||
if self.cache[name] then
|
self.template = self.cache[name]
|
||||||
self.template = self.cache[name]
|
|
||||||
else
|
|
||||||
self.template = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create a new namespace for this template
|
-- Create a new namespace for this template
|
||||||
self.viewns = {}
|
self.viewns = {}
|
||||||
|
|
Loading…
Reference in a new issue