|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
sarabtech Smarty Rookie
Joined: 06 Aug 2014 Posts: 5
|
Posted: Wed Aug 06, 2014 12:29 pm Post subject: Cache Groups and isCached issue |
|
|
I have the following code.
Code: |
<?php
require_once 'Smarty/libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->debugging = true;
$smarty->use_sub_dirs = true;
$smarty->compile_dir = 'templates_c';
$smarty->cache_dir = 'cache';
$smarty->template_dir = 'templates/';
$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
var_dump($smarty->isCached("index.tpl", 'sports|basketball'));
// clear all caches with 'sports' as the first two cache_id groups
$smarty->clearCache(null,'sports');
var_dump($smarty->isCached("index.tpl", 'sports|basketball'));
$smarty->display('index.tpl','sports|basketball');
?> |
First var_dump returns true and the second one returns false as expected.
But
Code: |
<?php
require_once 'Smarty/libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->debugging = true;
$smarty->use_sub_dirs = true;
$smarty->compile_dir = 'templates_c';
$smarty->cache_dir = 'cache';
$smarty->template_dir = 'templates/';
$smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
// clear all caches with 'sports' as the first two cache_id groups
$smarty->clearCache(null,'sports');
var_dump($smarty->isCached("index.tpl", 'sports|basketball'));
$smarty->display('index.tpl','sports|basketball');
?> |
This var_dump shows true. Actually I'm expecting false here. Because I have cleared the cachegroup of 'sports' before the var_dump.
Am I right? else I did any mistake?
Can anyone help me to understand this cache groups and isCached. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Aug 06, 2014 4:49 pm Post subject: |
|
|
I can't reproduce your problem.
As expected I always get false in the scond case.
Which version of Smarty do you use? |
|
Back to top |
|
sarabtech Smarty Rookie
Joined: 06 Aug 2014 Posts: 5
|
Posted: Thu Aug 07, 2014 5:45 am Post subject: |
|
|
Hi Admin,
I am using 3.1.17. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Aug 07, 2014 2:43 pm Post subject: |
|
|
Yes, 3.1.17 had here a bug which was fixed in 3.1.18.
You should upgrade your Smarty version 3.1.19 or SVN trunk. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|