Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
xcache.php
001 <?php
002 /**
003 *
004 * This file is part of the phpBB Forum Software package.
005 *
006 * @copyright (c) phpBB Limited <https://www.phpbb.com>
007 * @license GNU General Public License, version 2 (GPL-2.0)
008 *
009 * For full copyright and license information, please see
010 * the docs/CREDITS.txt file.
011 *
012 */
013
014 namespace phpbb\cache\driver;
015
016 /**
017 * ACM for XCache
018 *
019 * To use this module you need ini_get() enabled and the following INI settings configured as follows:
020 * - xcache.var_size > 0
021 * - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
022 *
023 */
024 class xcache extends \phpbb\cache\driver\memory
025 {
026 var $extension = 'XCache';
027
028 function __construct()
029 {
030 parent::__construct();
031
032 if (!function_exists('ini_get') || (int) ini_get('xcache.var_size') <= 0)
033 {
034 trigger_error('Increase xcache.var_size setting above 0 or enable ini_get() to use this ACM module.', E_USER_ERROR);
035 }
036 }
037
038 /**
039 * {@inheritDoc}
040 */
041 function purge()
042 {
043 // Run before for XCache, if admin functions are disabled it will terminate execution
044 parent::purge();
045
046 // If the admin authentication is enabled but not set up, this will cause a nasty error.
047 // Not much we can do about it though.
048 $n = xcache_count(XC_TYPE_VAR);
049
050 for ($i = 0; $i < $n; $i++)
051 {
052 xcache_clear_cache(XC_TYPE_VAR, $i);
053 }
054 }
055
056 /**
057 * Fetch an item from the cache
058 *
059 * @access protected
060 * @param string $var Cache key
061 * @return mixed Cached data
062 */
063 function _read($var)
064 {
065 $result = xcache_get($this->key_prefix . $var);
066
067 return ($result !== null) ? $result : false;
068 }
069
070 /**
071 * Store data in the cache
072 *
073 * @access protected
074 * @param string $var Cache key
075 * @param mixed $data Data to store
076 * @param int $ttl Time-to-live of cached data
077 * @return bool True if the operation succeeded
078 */
079 function _write($var, $data, $ttl = 2592000)
080 {
081 return xcache_set($this->key_prefix . $var, $data, $ttl);
082 }
083
084 /**
085 * Remove an item from the cache
086 *
087 * @access protected
088 * @param string $var Cache key
089 * @return bool True if the operation succeeded
090 */
091 function _delete($var)
092 {
093 return xcache_unset($this->key_prefix . $var);
094 }
095
096 /**
097 * Check if a cache var exists
098 *
099 * @access protected
100 * @param string $var Cache key
101 * @return bool True if it exists, otherwise false
102 */
103 function _isset($var)
104 {
105 return xcache_isset($this->key_prefix . $var);
106 }
107 }
108