[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/cache/driver/ -> apcu.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  namespace phpbb\cache\driver;
  15  
  16  /**
  17  * ACM for APCU
  18  */
  19  class apcu extends \phpbb\cache\driver\memory
  20  {
  21      var $extension = 'apcu';
  22  
  23      /**
  24      * {@inheritDoc}
  25      */
  26  	function purge()
  27      {
  28          if (PHP_SAPI !== 'cli' || @ini_get('apc.enable_cli'))
  29          {
  30              /*
  31               * Use an iterator to selectively delete our cache entries without disturbing
  32               * any other cache users (e.g. other phpBB boards hosted on this server)
  33               */
  34              apcu_delete(new \APCUIterator('#^' . $this->key_prefix . '#'));
  35          }
  36  
  37          parent::purge();
  38      }
  39  
  40      /**
  41      * Fetch an item from the cache
  42      *
  43      * @access protected
  44      * @param string $var Cache key
  45      * @return mixed Cached data
  46      */
  47  	function _read($var)
  48      {
  49          return apcu_fetch($this->key_prefix . $var);
  50      }
  51  
  52      /**
  53      * Store data in the cache
  54      *
  55      * @access protected
  56      * @param string $var Cache key
  57      * @param mixed $data Data to store
  58      * @param int $ttl Time-to-live of cached data
  59      * @return bool True if the operation succeeded
  60      */
  61  	function _write($var, $data, $ttl = 2592000)
  62      {
  63          return apcu_store($this->key_prefix . $var, $data, $ttl);
  64      }
  65  
  66      /**
  67      * Remove an item from the cache
  68      *
  69      * @access protected
  70      * @param string $var Cache key
  71      * @return bool True if the operation succeeded
  72      */
  73  	function _delete($var)
  74      {
  75          return apcu_delete($this->key_prefix . $var);
  76      }
  77  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1