From ff124c0a7590c4ee5899f0a36697ff2e4f52d3e9 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 22 Aug 2022 12:31:19 +0300 Subject: [PATCH] now the cache is storred on the .root page and shared by all decendents... Signed-off-by: Alex A. Naanou --- pwiki/page.js | 17 ++++++++--------- pwiki2.js | 3 ++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pwiki/page.js b/pwiki/page.js index 039db4e..c85a209 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -1274,18 +1274,17 @@ object.Constructor('Page', BasePage, { var CachedPage = module.CachedPage = object.Constructor('CachedPage', Page, { - // XXX should this always refer to .render_root.cachestore - cachestore: undefined, - /*/ - get cachestore(){ - return (this.render_root ?? this).__cachestore }, - set cachestore(value){ - ;(this.render_root ?? this).__cachestore = value }, - //*/ - // NOTE: set this to null/undefined/0 to disable... cache_timeout: '20m', + + // keep all the cache in one place -- .root + //__cachestore: undefined, + get cachestore(){ + return (this.root ?? this).__cachestore }, + set cachestore(value){ + ;(this.root ?? this).__cachestore = value }, + get cache(){ this.chechCache(this.path) return ((this.cachestore ?? {})[this.path] ?? {}).value }, diff --git a/pwiki2.js b/pwiki2.js index 05981a4..b1260a6 100755 --- a/pwiki2.js +++ b/pwiki2.js @@ -348,7 +348,8 @@ store.update('Settings', // XXX not yet sure how to organize the actual client -- UI, hooks, .. etc var pwiki = module.pwiki = - page.Page('/', '/', store) + //page.Page('/', '/', store) + page.CachedPage('/', '/', store) //---------------------------------------------------------------------