Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Cache Groups and isCached issue

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
sarabtech
Smarty Rookie


Joined: 06 Aug 2014
Posts: 5

PostPosted: Wed Aug 06, 2014 12:29 pm    Post subject: Cache Groups and isCached issue Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5067
Location: Hamburg / Germany

PostPosted: Wed Aug 06, 2014 4:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
sarabtech
Smarty Rookie


Joined: 06 Aug 2014
Posts: 5

PostPosted: Thu Aug 07, 2014 5:45 am    Post subject: Reply with quote

Hi Admin,

I am using 3.1.17.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5067
Location: Hamburg / Germany

PostPosted: Thu Aug 07, 2014 2:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP