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  * Memcache session storage handler for PHP
15  *
16  * @since       1.0
17  * @deprecated  2.0  The Storage class chain will be removed
18  */
19 class Memcache extends Storage
20 {
21     /**
22      * Container for server data
23      *
24      * @var    array
25      * @since  1.0
26      * @deprecated  2.0
27      */
28     protected $_servers = array();
29 
30     /**
31      * Constructor
32      *
33      * @param   array  $options  Optional parameters.
34      *
35      * @since   1.0
36      * @throws  \RuntimeException
37      * @deprecated  2.0
38      */
39     public function __construct($options = array())
40     {
41         if (!self::isSupported())
42         {
43             throw new \RuntimeException('Memcache Extension is not available', 404);
44         }
45 
46         // This will be an array of loveliness
47         // @todo: multiple servers
48         $this->_servers = array(
49             array(
50                 'host' => isset($options['memcache_server_host']) ? $options['memcache_server_host'] : 'localhost',
51                 'port' => isset($options['memcache_server_port']) ? $options['memcache_server_port'] : 11211
52             )
53         );
54 
55         parent::__construct($options);
56     }
57 
58     /**
59      * Register the functions of this class with PHP's session handler
60      *
61      * @return  void
62      *
63      * @since   1.0
64      * @deprecated  2.0
65      */
66     public function register()
67     {
68         ini_set('session.save_path', $this->_servers[0]['host'] . ':' . $this->_servers[0]['port']);
69         ini_set('session.save_handler', 'memcache');
70     }
71 
72     /**
73      * Test to see if the SessionHandler is available.
74      *
75      * @return  boolean  True on success, false otherwise.
76      *
77      * @since   1.0
78      * @deprecated  2.0
79      */
80     static public function isSupported()
81     {
82         return (extension_loaded('memcache') && class_exists('Memcache'));
83     }
84 }
85 
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.