4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Lucifix on October 26, 2010, 12:44:50 PM

Title: Different cache lifetime for guests?
Post by: Lucifix on October 26, 2010, 12:44:50 PM
Does anyone know if it's possible to have different lifetime of cache for guests and registered users?

Looks like calling user_info in global.php file is too early...
Title: Re: Different cache lifetime for guests?
Post by: V@no on October 26, 2010, 02:39:20 PM
You can try alter it at the end of sessions.php:
if ($user_info['user_level'] == GUEST)
{
  $cache_lifetime = 3600*2; //twice as long then for members
}
Title: Re: Different cache lifetime for guests?
Post by: Lucifix on October 26, 2010, 02:43:52 PM
I tried it and then in cache_utils.php added:
Code: [Select]
echo $cache_lifetime;
And it still show me 3600.

Maybe because file cache_utils.php is called in global.php.

And in index.php its like that:
Code: [Select]
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');

Maybe I could remove from globals.php
Code: [Select]
include_once(ROOT_PATH.'includes/cache_utils.php');
And add at the end of session.php

Code: [Select]

if ($user_info['user_level'] == GUEST)
{
  $cache_lifetime = 300; //twice as long then for members
}
include_once(ROOT_PATH.'includes/cache_utils.php');
Title: Re: Different cache lifetime for guests?
Post by: V@no on October 27, 2010, 08:13:34 AM
It doesn't matter where it's being added, what matters is from where the function is being executed. Add that echo inside get_cache_file function instead.
Title: Re: Different cache lifetime for guests?
Post by: x23piracy on October 27, 2010, 08:23:41 AM
Hi,

is it working?


Greetz X23
Title: Re: Different cache lifetime for guests?
Post by: Lucifix on October 27, 2010, 08:30:17 AM
It doesn't matter where it's being added, what matters is from where the function is being executed. Add that echo inside get_cache_file function instead.

I can confirm, it's working! ;)

http://www.4homepages.de/forum/index.php?topic=28160.msg152200#msg152200
Title: Re: Different cache lifetime for guests?
Post by: x23piracy on October 27, 2010, 09:53:30 AM
It doesn't matter where it's being added, what matters is from where the function is being executed. Add that echo inside get_cache_file function instead.

I can confirm, it's working! ;)

http://www.4homepages.de/forum/index.php?topic=28160.msg152200#msg152200

Hi,

just the lines to session.php...
that's all?


Greetz X23
Title: Re: Different cache lifetime for guests?
Post by: Lucifix on October 27, 2010, 09:55:13 AM
It doesn't matter where it's being added, what matters is from where the function is being executed. Add that echo inside get_cache_file function instead.

I can confirm, it's working! ;)

http://www.4homepages.de/forum/index.php?topic=28160.msg152200#msg152200

Hi,

just the lines to session.php...
that's all?


Greetz X23

Correct ;)