XF 2.1 lifetime for caching css

John rus

Member
i use sharing hosting, so can not use Redis
for caching css i'm trying to apply this code:

Code:
$config['cache']['context']['css'] = [
            'provider' => 'Filesystem',
            'config' => [
  'directory' => 'cache/'

            ],
        ];

this works for me, but by default has lifetime 300 sec.
how i can change the code for increase lifetime ?
i tried different variants, but could not
 
Last edited:
i use sharing hosting, so can not use Redis
for caching css i'm trying to apply this code:

Code:
$config['cache']['context']['css'] = [
            'provider' => 'Filesystem',
            'config' => [
  'directory' => 'cache/'

            ],
        ];

this works for me, but by default has lifetime 300 sec.
how i can change the code for increase lifetime ?
i tried different variants, but could not


Yes that's true. This may be understandable for developers, but it is rather confusing for normal admins.
If the value "300" now comes instead of lifetime, or in brackets after it: $ config ['pageCache'] ['lifetime'] (default: 300)

So:? $ config ['pageCache'] ['lifetime'] (300) or so: $ config ['pageCache'] ['300']

Examples that are really applicable would be very helpful.
 
That's for page caching, which is a little different. You can set the lifetime there using something like: $config['pageCache']['lifetime'] = 600;

The CSS cache TTL should be an hour, regardless of which back-end you use.
 
That's for page caching, which is a little different. You can set the lifetime there using something like: $config['pageCache']['lifetime'] = 600;

The CSS cache TTL should be an hour, regardless of which back-end you use.
Thank you, that is now much more understandable and descriptive than in the manual ;)

In this context:
$config['cache']['context']['css'] = [
'provider' => 'Filesystem',
'config' => [
'directory' => 'cache/',
'lifetime' => '900',
],
];
for css-caching and 900 sec. livetime
 
I could be wrong, but I don't think the lifetime config option has any effect. The cache lifetime is given when setting individual cache items, not on the provider itself.
 
In this context:
$config['cache']['context']['css'] = [
'provider' => 'Filesystem',
'config' => [
'directory' => 'cache/',
'lifetime' => '900',
],
];
for css-caching and 900 sec. livetime
thank, but i try this code before
lifetime not working for css :cry:
it working for page only

and there is a second problem - when using cache 'Filesystem', not clearing old cache file
not clearing cache
 
Back
Top Bottom