[Catalyst] Sessions, Auth::CDBI, and static files

Thomas L. Shinnick tshinnic at io.com
Sun Sep 4 09:05:41 CEST 2005


I've converted over to Static::Simple (thank you AngyG!) and it feels so good when running on Windows (where File::MMagic doesn't install)  But since I've been working on sessions I've noticed something disturbing.  

The combination of Authentication::CDBI and Static::Simple or Static means that every request, even for static files, will force loading of session data.

Authentication::CDBI uses the prepare_action() hook to access session data to copy values {user} and {user_id} into $c->request.  So _every_ request will load session data?

Static::Simple hooks into the dispatch() chain (after all prepare_* steps have executed) as a good place to check if the path matches a static file.  The advantage is that, if a static file is found, it returns immediately short-circuiting the rest of the dispatch chain - it has done the "thing needed" and doesn't need to involve an application action.

Now that I look back, the Static plugin would not avoid the accesses to session data, as it is implemented by application actions, so the prepare_* steps will have taken place.

So, is it an unavoidable consequence of having plugins perform real work in prepare_* steps, that every action and every request is going to have all the overhead of all the plugins installed?

Tom (shenme on irc #catalyst)


-- 
I'm a pessimist about probabilities; I'm an optimist about possibilities.
    Lewis Mumford  (1895-1990) 





More information about the Catalyst mailing list