Cache time

Post Reply
DanS2
Posts: 130
Joined: Tue Feb 12, 2013 2:42 pm

Cache time

Post by DanS2 »

Hi,

is it possible to have a different cache time for index and /category/All/date/1/ compared to all the rest of the files?

What I mean is, I would like to have the index and the first page of new videos rebuilding faster, more dynamic than the whole rest of the site.
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: Cache time

Post by admin »

Yes, you can define CACHE_TIME in common.php

for example
if (your condition) {
define('CACHE_TIME', 500);
} elseif (another condition) {
define('CACHE_TIME', 1000);
}

and so on
Don't forget to run script update
DanS2
Posts: 130
Joined: Tue Feb 12, 2013 2:42 pm

Re: Cache time

Post by DanS2 »

That sounds good.

I am not a programmer. Can you explain a little more what I have to do?
How do I define the conditions?
DanS2
Posts: 130
Joined: Tue Feb 12, 2013 2:42 pm

Re: Cache time

Post by DanS2 »

Lets say I want to have the index cache time at 60, and this page /category/All/date/1/ at 60
and everything else at 900?
admin
Site Admin
Posts: 38004
Joined: Wed Sep 10, 2008 11:43 am

Re: Cache time

Post by admin »

if ($_SERVER['REQUEST_URI'] == '/') {
define('CACHE_TIME', 60);
} elseif ($_GET['order'] == 'date') {
define('CACHE_TIME', 60);
} else {
define('CACHE_TIME', 900);
}


This is an example, I didn't test it
Don't forget to run script update
Post Reply