[prev in list] [next in list] [prev in thread] [next in thread]
List: smarty-dev
Subject: [SMARTY-DEV] Suggested (downcompatible) Solution
From: 80.141.77.221
Date: 2002-04-13 6:56:30
[Download RAW message or body]
"Norbert röcher" <norbert.roecher@t-online.de> schrieb:
> Well, after a bag of sleep: what about just another status for
> "caching"?
>
> caching = 0; -> no caching
> caching = 1; -> expire by lifetime
> caching = 2; -> expire by expiration
>
> This enables the user to choose without any "bad" consequences after
an
> update or a change. No need for "clear_cache" or anything like that.
An
> expire by lifetime would work, even after month of using "expiration"
> and same in reverse. It could be made fully downcompatible to running
> systems.
I've done a little hack for this:
change 1 (insert on line 1417):
if ($this->cache_lifetime >= 0){
// expiration set
$this->_cache_info['expires'] =
$this->_cache_info['timestamp'] + $this->cache_lifetime;
} else {
// cache will never expire
$this->_cache_info['expires'] = -1;
}
change 2 (replace [new] lines 1489-1492 with this):
if ($this->caching == 2 && isset
($this->_cache_info['expires'])){
// caching by expiration time
if ($this->_cache_info['expires'] >= 0 && (time() >
$this->_cache_info['expires'])) {
// cache expired, regenerate
return false;
}
} else {
// caching by lifetime
if ($this->cache_lifetime > 0 && (time() -
$this->_cache_info['timestamp'] > $this->cache_lifetime)) {
// cache expired, regenerate
return false;
}
}
This is fully downcompatible, tested and works just fine. No new
params, just a new status ($caching = 2 -> 'cache by expiration').
Switching between $caching=1 and $caching=2 works also and has the
expected effect.
Regards,
Norbert
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic