Page 1 of 1

Cache time

Posted: Fri Jun 19, 2015 5:19 am
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.

Re: Cache time

Posted: Fri Jun 19, 2015 11:32 am
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

Re: Cache time

Posted: Fri Jun 19, 2015 12:07 pm
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?

Re: Cache time

Posted: Fri Jun 19, 2015 12:09 pm
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?

Re: Cache time

Posted: Fri Jun 19, 2015 9:01 pm
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