| 148 |
lars |
1 |
\$cache\_lifetime {#variable.cache.lifetime}
|
|
|
2 |
=================
|
|
|
3 |
|
|
|
4 |
This is the length of time in seconds that a template cache is valid.
|
|
|
5 |
Once this time has expired, the cache will be regenerated.
|
|
|
6 |
|
|
|
7 |
- `$caching` must be turned on (either
|
|
|
8 |
Smarty::CACHING\_LIFETIME\_CURRENT or
|
|
|
9 |
Smarty::CACHING\_LIFETIME\_SAVED) for `$cache_lifetime` to have any
|
|
|
10 |
purpose.
|
|
|
11 |
|
|
|
12 |
- A `$cache_lifetime` value of -1 will force the cache to never
|
|
|
13 |
expire.
|
|
|
14 |
|
|
|
15 |
- A value of 0 will cause the cache to always regenerate (good for
|
|
|
16 |
testing only, to disable caching a more efficient method is to set
|
|
|
17 |
[`$caching`](#variable.caching) = Smarty::CACHING\_OFF).
|
|
|
18 |
|
|
|
19 |
- If you want to give certain templates their own cache lifetime, you
|
|
|
20 |
could do this by setting [`$caching`](#variable.caching) =
|
|
|
21 |
Smarty::CACHING\_LIFETIME\_SAVED, then set `$cache_lifetime` to a
|
|
|
22 |
unique value just before calling [`display()`](#api.display) or
|
|
|
23 |
[`fetch()`](#api.fetch).
|
|
|
24 |
|
|
|
25 |
If [`$force_compile`](#variable.force.compile) is enabled, the cache
|
|
|
26 |
files will be regenerated every time, effectively disabling caching. You
|
|
|
27 |
can clear all the cache files with the
|
|
|
28 |
[`clear_all_cache()`](#api.clear.all.cache) function, or individual
|
|
|
29 |
cache files (or groups) with the [`clear_cache()`](#api.clear.cache)
|
|
|
30 |
function.
|