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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

eaccelerator.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 2.08 KiB


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 eAccelerator
018  * @todo Missing locks from destroy() talk with David
019  */
020  class eaccelerator extends \phpbb\cache\driver\memory
021  {
022      var $extension = 'eaccelerator';
023      var $function = 'eaccelerator_get';
024   
025      var $serialize_header = '#phpbb-serialized#';
026   
027      /**
028      * {@inheritDoc}
029      */
030      function purge()
031      {
032          foreach (eaccelerator_list_keys() as $var)
033          {
034              // @todo Check why the substr()
035              // @todo Only unset vars matching $this->key_prefix
036              eaccelerator_rm(substr($var['name'], 1));
037          }
038   
039          parent::purge();
040      }
041   
042      /**
043      * {@inheritDoc}
044      */
045      function tidy()
046      {
047          eaccelerator_gc();
048   
049          set_config('cache_last_gc', time(), true);
050      }
051   
052      /**
053      * Fetch an item from the cache
054      *
055      * @access protected
056      * @param string $var Cache key
057      * @return mixed Cached data
058      */
059      function _read($var)
060      {
061          $result = eaccelerator_get($this->key_prefix . $var);
062   
063          if ($result === null)
064          {
065              return false;
066          }
067   
068          // Handle serialized objects
069          if (is_string($result) && strpos($result, $this->serialize_header . 'O:') === 0)
070          {
071              $result = unserialize(substr($result, strlen($this->serialize_header)));
072          }
073   
074          return $result;
075      }
076   
077      /**
078      * Store data in the cache
079      *
080      * @access protected
081      * @param string $var Cache key
082      * @param mixed $data Data to store
083      * @param int $ttl Time-to-live of cached data
084      * @return bool True if the operation succeeded
085      */
086      function _write($var, $data, $ttl = 2592000)
087      {
088          // Serialize objects and make them easy to detect
089          $data = (is_object($data)) ? $this->serialize_header . serialize($data) : $data;
090   
091          return eaccelerator_put($this->key_prefix . $var, $data, $ttl);
092      }
093   
094      /**
095      * Remove an item from the cache
096      *
097      * @access protected
098      * @param string $var Cache key
099      * @return bool True if the operation succeeded
100      */
101      function _delete($var)
102      {
103          return eaccelerator_rm($this->key_prefix . $var);
104      }
105  }
106