[Web-SIG] Session interface
Ian Bicking
ianb at colorstudy.com
Tue Aug 16 18:28:04 CEST 2005
I wrote a possible interface for sessions:
http://aspn.activestate.com/ASPN/CodeDoc/Apache-mod_perl_guide/src/modules.html
It's not my most thoughtful effort, but maybe it can be a discussion
point. Feel free to offer completely different APIs if you think this
one sucks. I basically just threw in properties and methods for all the
functionality I've thought of by reading a couple APIs and the
discussion here, without actually thinking about how it goes together :-/
In this interface presumably you make subclasses of an abstract class to
implement different storage backends and do some kinds of configuration.
Thinking on it more, probably a good place to start would be agreeing on
specific terminology for the objects involved, since I've seen several
different sets of terminology, many of which use the same words for
different ideas:
Session:
An instance of this represents one user/browser's session.
SessionStore:
An instance of this represents the persistence mechanism. This
is a functional component, not embodying any policy.
SessionManager:
This is a container for sessions, and uses a SessionStore. This
contains all the policy for loading, saving, locking, expiring
sessions.
Does that sound good? Note that the attached interface conflates
SessionStore and SessionManager. Some interfaces make an explicit
ApplicationSession, which is contained by Session and keyed off some
application ID; my interface implies that separation, but does not
enforce it, and does not offer any extra functionality at that level
(e.g., per-ApplicationSession locks or transactions).
More information about the Web-SIG
mailing list