Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

custom cache handler function and is_cached

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
jtm
Smarty Rookie


Joined: 13 Nov 2003
Posts: 9

PostPosted: Thu Nov 20, 2003 4:15 pm    Post subject: custom cache handler function and is_cached Reply with quote

It seems that when using custom cache handler function the call to is_cached executes the custom handler with 'read' action. This makes the handler to fetch the entire cache page from somewhere.

Because is_cache only need to know if the page is in cache or not, the custom cache handler function fetchs the cache data for nothing:

suggestion:

Add 'is_cache' action into the custom cache handler so that the developper who creates his own cache handler function can optimize this (for example, the function can just check if (file_exists(...)) without actually opening and reading the file.)

- jtm

edit: typos
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Nov 20, 2003 4:47 pm    Post subject: Reply with quote

it is intended behaviour that is_cached() reads the file. this is regardless of a user defined cache_handler_func() or the built-in one. this avoids a race-condition that may occur between the is_cached() and the fetch() call. if is_cached() was called before then fetch() simply returns the page that was gathered with is_cached() before.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Feature Requests 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