JOOMLA中国
  • Joomla中国首页
  • 社区
  • 教程
  • 应用市场
  • B计划
Joomla! Framework TM
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • Composer
    • Autoload
  • Joomla
    • Application
      • Cli
        • Output
          • Processor
      • Web
    • Data
    • DI
      • Exception
    • Event
    • Filter
    • Input
    • Ldap
    • Registry
      • Format
    • Session
      • Storage
    • String
    • Uri
    • Utilities
  • None
  • PasswordCompat
    • binary
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Yaml
        • Exception
    • Polyfill
      • Util

Classes

  • Apc
  • Database
  • Memcache
  • Memcached
  • None
  • Wincache
  • Xcache
  1 <?php
  2 /**
  3  * Part of the Joomla Framework Session Package
  4  *
  5  * @copyright  Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
  6  * @license    GNU General Public License version 2 or later; see LICENSE
  7  */
  8 
  9 namespace Joomla\Session\Storage;
 10 
 11 use Joomla\Session\Storage;
 12 
 13 /**
 14  * XCache session storage handler
 15  *
 16  * @since       1.0
 17  * @deprecated  2.0  The Storage class chain will be removed
 18  */
 19 class Xcache extends Storage
 20 {
 21     /**
 22      * Constructor
 23      *
 24      * @param   array  $options  Optional parameters.
 25      *
 26      * @since   1.0
 27      * @throws  \RuntimeException
 28      * @deprecated  2.0
 29      */
 30     public function __construct($options = array())
 31     {
 32         if (!self::isSupported())
 33         {
 34             throw new \RuntimeException('XCache Extension is not available', 404);
 35         }
 36 
 37         parent::__construct($options);
 38     }
 39 
 40     /**
 41      * Read the data for a particular session identifier from the SessionHandler backend.
 42      *
 43      * @param   string  $id  The session identifier.
 44      *
 45      * @return  string  The session data.
 46      *
 47      * @since   1.0
 48      * @deprecated  2.0
 49      */
 50     public function read($id)
 51     {
 52         $sess_id = 'sess_' . $id;
 53 
 54         // Check if id exists
 55         if (!xcache_isset($sess_id))
 56         {
 57             return;
 58         }
 59 
 60         return (string) xcache_get($sess_id);
 61     }
 62 
 63     /**
 64      * Write session data to the SessionHandler backend.
 65      *
 66      * @param   string  $id            The session identifier.
 67      * @param   string  $session_data  The session data.
 68      *
 69      * @return  boolean  True on success, false otherwise.
 70      *
 71      * @since   1.0
 72      * @deprecated  2.0
 73      */
 74     public function write($id, $session_data)
 75     {
 76         $sess_id = 'sess_' . $id;
 77 
 78         return xcache_set($sess_id, $session_data, ini_get("session.gc_maxlifetime"));
 79     }
 80 
 81     /**
 82      * Destroy the data for a particular session identifier in the SessionHandler backend.
 83      *
 84      * @param   string  $id  The session identifier.
 85      *
 86      * @return  boolean  True on success, false otherwise.
 87      *
 88      * @since   1.0
 89      * @deprecated  2.0
 90      */
 91     public function destroy($id)
 92     {
 93         $sess_id = 'sess_' . $id;
 94 
 95         if (!xcache_isset($sess_id))
 96         {
 97             return true;
 98         }
 99 
100         return xcache_unset($sess_id);
101     }
102 
103     /**
104      * Test to see if the SessionHandler is available.
105      *
106      * @return  boolean  True on success, false otherwise.
107      *
108      * @since   1.0
109      * @deprecated  2.0
110      */
111     static public function isSupported()
112     {
113         return (extension_loaded('xcache'));
114     }
115 }
116 
Joomla! Framework TM API documentation generated by ApiGen 2.8.0
Joomla!® and Joomla! Framework™ are trademarks of Open Source Matters, Inc. in the United States and other countries.