Page 2 of 2

Posted: Tue Aug 22, 2006 2:40 pm
by Luke
Since I would like for the database interaction to be as lightweight as possible here (and as portable as possible), I am thinking about just supplying the session handler with a database connection resource in its constructor and then build individual handlers for each type of database I need to use, and effectively elimitate ADOdb from this class completely.I do not like having that dependancy anyway.

This would allow me to take advantage of database-type-specific functionality such as mysql's "replace" as well. What do you guys think?

Posted: Tue Aug 22, 2006 2:49 pm
by feyd
I'd use Composition. Make the session handler storage medium agnostic by giving it a known interface that isn't, in itself, specific to any medium of storage. The implementation inside this interface could store the actual data in any location from there, be it database, files, or a mixture of the two.

Posted: Tue Aug 22, 2006 2:53 pm
by Luke
feyd wrote:I'd use Composition. Make the session handler storage medium agnostic by giving it a known interface that isn't, in itself, specific to any medium of storage. The implementation inside this interface could store the actual data in any location from there, be it database, files, or a mixture of the two.
Maybe I misunderstand you, but isn't that what I am doing with the SessionSaveHandler interface?

Posted: Tue Aug 22, 2006 2:58 pm
by feyd
The Ninja Space Goat wrote:Maybe I misunderstand you, but isn't that what I am doing with the SessionSaveHandler interface?
Apparently, yes. :D I was responding to your most recent post about storing a database connection resource in its constructor. That read to me that you'd be given the session class itself the resource. I clearly hadn't read your entire code when I posted.

Posted: Tue Aug 22, 2006 2:59 pm
by Luke
so, I did something right!! Woohoo! lol

Posted: Tue Aug 22, 2006 3:06 pm
by feyd
Was I correct in understanding that your idea is to give the session class itself the resource or was it the SessionSaveHandler derivative? Going with the former starts down the slope while the latter keeps it associated with the thing that will care about such nonsense. That was the major point I was trying to get across.

Posted: Tue Aug 22, 2006 3:27 pm
by Luke
I have made the changes and updated that classes. Please let me know what y'all think.
Jenk wrote:FYI: you can scratch your @todo for function clean() because $max is the time in miliseconds that a session expires, the PHP engine provides this time.
Thanks :wink:
Jenk wrote:And furthermore.. when specifying optional arguments like you have done, you should always declare mandatory arguments first:

Code: Select all

public function __construct(ADOConnection $db, $namespace='Session', $regenerate=null){
otherwise your optional args are no longer optional :)
My problem with that is that it changes the way you access the session class... which I don't like. I want it to be the same, regardless of how it stores the data. I will have to think about this one.... I set up a fix I think will work for now

EDIT: I suppose it really is impossible to do that now that I think about it... it's going to be different no matter what because I HAVE to supply the link. hmm...