Hello,
I've some questions about the cache:
1. A cache file is created using the current language, theme and module. Is it possible to add a var name to this file?
2. I'm using a same template file for many module but the content of this template vary a lot, depending of the module to display. So if I use cache for this template, the cache will be register with the module A and if I try after that to display the content of the module B, it will display the cache file of the module A?
3. Same question as question 2, with only one module but with a display that may change a lot depending of the group permissions.
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Some questions about cache
-
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
-
- Rank: Team Member
- Registered: Apr 07, 2005
- Last visit: Jan 18, 2010
- Posts: 228
Ad 1. You may use cache_id property of Renderer object. It allows you to add to cache identifier some custom values, eg user id or whatever you need.
In menutree I've used user id to differentiate cache for users due to user based permissions:
http://code.zikula.org/bianor/browser/trunk/menutree/modules/menutree/pnblocks/menutree.php#L42
(the same solution is in extmenu)
Ad 2. The same template for different modules should work fine. Renderer always build cache_id using base URL, module name and optional cache_id provided by module author. So the same tpl for different modules should have different cache id's
Ad 3. The same as point 1 - use cache_id property and add to it group ids.
--
Polish Zikula Team
Bianor Works - my Zikula works on CoZi -
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
Thank you Jusuff! I've all the information that I need, I will add to cache identifier some custom values.
-
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
I've a new question about the cache, I try to override the system value of the cache. If the cache is disable, I do this to force it:
Code
$render =& pnRender::getInstance('Sitemap');
$cachest_default = pnModGetVar('pnRender', 'cache');
if ($smconf['cachest'] == 1) {
if ($cachest_default == 0) {
// Force caching
$render->caching = 1;
}
// Set cache lifetime
$render->cache_lifetime = $smconf['cachelt'];
}
That's work, after that I fetch the template, then disable the cache:
Code
$return = $render->fetch('sitemap_user_view.html');
// Recover cache state/information
if ($smconf['cachest'] == 1 && $cachest_default == 0) {
$render->caching = 0;
}
return $return;
The first time that this function is load, it's ok, the cache is created only for the sitemap module. But after that, when this function is load, the cache is enable for all the website... :(
edited by: Yokav, datetimebrief
- Moderated by:
- Support
