Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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.10 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          global $config;
048   
049          eaccelerator_gc();
050   
051          $config->set('cache_last_gc', time(), false);
052      }
053   
054      /**
055      * Fetch an item from the cache
056      *
057      * @access protected
058      * @param string $var Cache key
059      * @return mixed Cached data
060      */
061      function _read($var)
062      {
063          $result = eaccelerator_get($this->key_prefix . $var);
064   
065          if ($result === null)
066          {
067              return false;
068          }
069   
070          // Handle serialized objects
071          if (is_string($result) && strpos($result, $this->serialize_header . 'O:') === 0)
072          {
073              $result = unserialize(substr($result, strlen($this->serialize_header)));
074          }
075   
076          return $result;
077      }
078   
079      /**
080      * Store data in the cache
081      *
082      * @access protected
083      * @param string $var Cache key
084      * @param mixed $data Data to store
085      * @param int $ttl Time-to-live of cached data
086      * @return bool True if the operation succeeded
087      */
088      function _write($var, $data, $ttl = 2592000)
089      {
090          // Serialize objects and make them easy to detect
091          $data = (is_object($data)) ? $this->serialize_header . serialize($data) : $data;
092   
093          return eaccelerator_put($this->key_prefix . $var, $data, $ttl);
094      }
095   
096      /**
097      * Remove an item from the cache
098      *
099      * @access protected
100      * @param string $var Cache key
101      * @return bool True if the operation succeeded
102      */
103      function _delete($var)
104      {
105          return eaccelerator_rm($this->key_prefix . $var);
106      }
107  }
108