[ Indice ]

Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4

Servizio fornito da VMItalia
Classe:   Funzione:   Variabile:   Costante:  
Storico Ricerche +

titolo

Corpo

[chiudi]

/libraries/joomla/session/storage/ -> xcache.php (sorgente)

   1  <?php
   2  /**
   3  * @version        $Id:apc.php 6961 2007-03-15 16:06:53Z tcp $
   4  * @package        Joomla.Framework
   5  * @subpackage    Session
   6  * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // Check to ensure this file is within the rest of the framework
  16  defined('JPATH_BASE') or die();
  17  
  18  /**
  19   * XCache session storage handler
  20   *
  21   * @package        Joomla.Framework
  22   * @subpackage    Cache
  23   * @since        1.5
  24   */
  25  class JSessionStorageXcache extends JSessionStorage
  26  {
  27      /**
  28      * Constructor
  29      *
  30      * @access protected
  31      * @param array $options optional parameters
  32      */
  33  	function __construct( $options = array() )
  34      {
  35          if (!$this->test()) {
  36              return JError::raiseError(404, "The xcache extension isn't available");
  37          }
  38  
  39          parent::__construct($options);
  40      }
  41  
  42      /**
  43       * Open the SessionHandler backend.
  44       *
  45       * @access public
  46       * @param string $save_path     The path to the session object.
  47       * @param string $session_name  The name of the session.
  48       * @return boolean  True on success, false otherwise.
  49       */
  50  	function open($save_path, $session_name)
  51      {
  52          return true;
  53      }
  54  
  55      /**
  56       * Close the SessionHandler backend.
  57       *
  58       * @access public
  59       * @return boolean  True on success, false otherwise.
  60       */
  61  	function close()
  62      {
  63          return true;
  64      }
  65  
  66       /**
  67        * Read the data for a particular session identifier from the
  68        * SessionHandler backend.
  69        *
  70        * @access public
  71        * @param string $id  The session identifier.
  72        * @return string  The session data.
  73        */
  74  	function read($id)
  75      {
  76          $sess_id = 'sess_'.$id;
  77  
  78          //check if id exists
  79          if( !xcache_isset( $sess_id ) ){
  80              return;
  81          }
  82  
  83          return (string)xcache_get($sess_id);
  84      }
  85  
  86      /**
  87       * Write session data to the SessionHandler backend.
  88       *
  89       * @access public
  90       * @param string $id            The session identifier.
  91       * @param string $session_data  The session data.
  92       * @return boolean  True on success, false otherwise.
  93       */
  94  	function write($id, $session_data)
  95      {
  96          $sess_id = 'sess_'.$id;
  97          return xcache_set($sess_id, $session_data, ini_get("session.gc_maxlifetime")  );
  98      }
  99  
 100      /**
 101        * Destroy the data for a particular session identifier in the
 102        * SessionHandler backend.
 103        *
 104        * @access public
 105        * @param string $id  The session identifier.
 106        * @return boolean  True on success, false otherwise.
 107        */
 108  	function destroy($id)
 109      {
 110          $sess_id = 'sess_'.$id;
 111  
 112          if( !xcache_isset( $sess_id ) ){
 113              return true;
 114          }
 115  
 116          return xcache_unset($sess_id);
 117      }
 118  
 119      /**
 120       * Garbage collect stale sessions from the SessionHandler backend.
 121       *
 122       * @access public
 123       * @param integer $maxlifetime  The maximum age of a session.
 124       * @return boolean  True on success, false otherwise.
 125       */
 126      function gc($maxlifetime)
 127      {
 128          return true;
 129      }
 130  
 131      /**
 132       * Test to see if the SessionHandler is available.
 133       *
 134       * @static
 135       * @access public
 136       * @return boolean  True on success, false otherwise.
 137       */
 138  	function test() {
 139          return (extension_loaded('xcache'));
 140      }
 141  }


Generato il: Mon Oct 19 20:29:27 2009 Generato con PHPXref 0.7