Author Topic: Different cache lifetime for guests?  (Read 7172 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Different cache lifetime for guests?
« 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...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Different cache lifetime for guests?
« Reply #1 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
}

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: Different cache lifetime for guests?
« Reply #2 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');
« Last Edit: October 26, 2010, 02:57:51 PM by Lucifix »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Different cache lifetime for guests?
« Reply #3 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: Different cache lifetime for guests?
« Reply #4 on: October 27, 2010, 08:23:41 AM »
Hi,

is it working?


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: Different cache lifetime for guests?
« Reply #5 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

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: Different cache lifetime for guests?
« Reply #6 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

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: Different cache lifetime for guests?
« Reply #7 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 ;)