I'm trying to write a plugin which will decide weather or not to use cache 
based weather or not a user is logged in. This is what I have come up with 
so far:

-------------------
package Apache::AxKit::Plugin::VBTNUserCache;
use strict;

use Apache::Request;
use Apache::Constants qw(OK);
use Apache::AxKit::Plugin::Session;
use Apache::AxKit::Cache;

sub handler {
    my $r = shift;
    my $session = Apache->request->pnotes ("SESSION");
    return OK unless ($$session{'vbtn_access_user'});
    $r->no_cache(1);
    return OK;
}
----------------------

So I check to see if a user is logged in. If not, I return OK and the 
cached content is delivered (AxNoCache is set to Off in httpd.conf)... 
Great. However, if a user is logged in, I attempt to turn off cache by 
$r->no_cache(1); - This does not seem to work... Is this being overriden 
later on by some AxKit internals I am not aware of? Is it even possible to 
turn off cache from within a plugin?

A workaround I came up with was to append the username to the 
'axkit_cache_extra' variable:

    I replaced $r->no_cache(1); 
        with
    $r->notes('axkit_cache_extra', $r->notes('axkit_cache_extra') . 
$$session{'vbtn_access_user'});

which means that every user has his/her own individual set of cache 
files... This is not goos since I have over 25000 registered users on the 
site and each one has his own cache file for every page... well, thats a 
lot of cache files.

All I want to do is make guest users get there contet from the cache, and 
loged in users gererate their contet on the fly (because I like to 
customise each page to the user).


help appreciated (again!)
thanks

-- 
Tom Kirkpatrick
Web Developer - Virus Bulletin

Reply via email to