Overview

Packages

  • SessionHandler

Classes

  • Horde_SessionHandler
  • Horde_SessionHandler_Exception
  • Horde_SessionHandler_Storage
  • Horde_SessionHandler_Storage_Builtin
  • Horde_SessionHandler_Storage_External
  • Horde_SessionHandler_Storage_File
  • Horde_SessionHandler_Storage_Memcache
  • Horde_SessionHandler_Storage_Sql
  • Horde_SessionHandler_Storage_Stack
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * This is the abstract class that all storage drivers inherit from.
  4:  *
  5:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
  6:  *
  7:  * See the enclosed file COPYING for license information (LGPL). If you
  8:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
  9:  *
 10:  * @author   Michael Slusarz <slusarz@horde.org>
 11:  * @category Horde
 12:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 13:  * @package  SessionHandler
 14:  */
 15: abstract class Horde_SessionHandler_Storage
 16: {
 17:     /**
 18:      * Access session read-only?
 19:      *
 20:      * @var boolean
 21:      */
 22:     public $readonly = false;
 23: 
 24:     /**
 25:      * A logger instance.
 26:      *
 27:      * @var Horde_Log_Logger
 28:      */
 29:     protected $_logger;
 30: 
 31:     /**
 32:      * Hash containing connection parameters.
 33:      *
 34:      * @var array
 35:      */
 36:     protected $_params = array();
 37: 
 38:     /**
 39:      * Constructor.
 40:      *
 41:      * @param array $params  Configuration parameters.
 42:      */
 43:     public function __construct(array $params = array())
 44:     {
 45:         $this->_params = array_merge($this->_params, $params);
 46:     }
 47: 
 48:     /**
 49:      * Set the logger object.
 50:      *
 51:      * @param Horde_Log_Logger $log  The logger instance.
 52:      */
 53:     public function setLogger(Horde_Log_Logger $log)
 54:     {
 55:         $this->_logger = $log;
 56:     }
 57: 
 58:     /**
 59:      * Open the backend.
 60:      *
 61:      * @param string $save_path     The path to the session object.
 62:      * @param string $session_name  The name of the session.
 63:      *
 64:      * @throws Horde_SessionHandler_Exception
 65:      */
 66:     abstract public function open($save_path = null, $session_name = null);
 67: 
 68:     /**
 69:      * Close the backend.
 70:      *
 71:      * @throws Horde_SessionHandler_Exception
 72:      */
 73:     abstract public function close();
 74: 
 75:     /**
 76:      * Read the data for a particular session identifier from the backend.
 77:      *
 78:      * @param string $id  The session identifier.
 79:      *
 80:      * @return string  The session data.
 81:      */
 82:     abstract public function read($id);
 83: 
 84:     /**
 85:      * Write session data to the backend.
 86:      *
 87:      * @param string $id            The session identifier.
 88:      * @param string $session_data  The session data.
 89:      *
 90:      * @return boolean  True on success, false otherwise.
 91:      */
 92:     abstract public function write($id, $session_data);
 93: 
 94:     /**
 95:      * Destroy the data for a particular session identifier in the backend.
 96:      * This method should only be called internally by PHP via
 97:      * session_set_save_handler().
 98:      *
 99:      * @param string $id  The session identifier.
100:      *
101:      * @return boolean  True on success, false otherwise.
102:      */
103:     abstract public function destroy($id);
104: 
105:     /**
106:      * Garbage collect stale sessions from the backend.
107:      * This method should only be called internally by PHP via
108:      * session_set_save_handler().
109:      *
110:      * @param integer $maxlifetime  The maximum age of a session.
111:      *
112:      * @return boolean  True on success, false otherwise.
113:      */
114:     abstract public function gc($maxlifetime = 300);
115: 
116:     /**
117:      * Get a list of the valid session identifiers.
118:      *
119:      * @return array  A list of valid session identifiers.
120:      * @throws Horde_SessionHandler_Exception
121:      */
122:     abstract public function getSessionIDs();
123: 
124: }
125: 
API documentation generated by ApiGen