Chirpy!

Latest Version: 0.3
Released: 2007-02-09

Chirpy! 0.2 API Documentation

<<
Chirpy::UI::WebApp::Session::DataManager

NAME

Chirpy::UI::WebApp::Session::DataManager - Abstract data manager class specific to Chirpy::UI::WebApp::Session

USAGE

This class is required by Chirpy::UI::WebApp's session manager Chirpy::UI::WebApp::Session. It is an abstract class representing a data manager for session information.

If you wish to create an implementation of this class, the easiest way is to extend an existing Chirpy::DataManager implementation with this class's methods.

The class also has two non-abstract object method, namely remove_expired_sessions() and remove_expired_sessions_if_necessary(). The former returns a list containing the IDs of the sessions that have expired and have consequently been removed. The latter does the same, but only every 24 hours; otherwise, it returns undef.

IMPLEMENTATION

If you want to make your Chirpy::DataManager compatible with Chirpy::UI::WebApp::Session, all you need to do is implement a few extra object methods for creating, retrieving, updating and deleting sessions. You will probably also have to extend your set_up() and remove() methods accordingly. The extra methods to implement are as follows:

add_session($id, $data)

Stores the session with ID $id and session data $data. $data is a hash reference, so you will probably have to serialize it. How you do that is up to you, but Data::Dumper makes it easy. Returns a true value upon success.

get_sessions(@ids)

Returns a list containing the data hash for each session whose ID is contained in @ids, or all sessions if @ids is empty. If no sessions are found, returns an empty list (and not undef).

modify_session($id, $data)

Updates the existing session with ID $id with the data from the hash referred to by $data.

remove_sessions(@ids)

Removes all sessions with an ID contained in @ids from the system. Returns the number of removed sessions.

AUTHOR

Tim De Pauw <ceetee@users.sourceforge.net>

SEE ALSO

Chirpy::UI::WebApp::Session, Chirpy::DataManager::MySQL, Chirpy::DataManager, Chirpy, http://chirpy.sourceforge.net/

COPYRIGHT

Copyright 2005-2006 Tim De Pauw. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.