Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

MemcacheSessionHandler.php

Zuletzt modifiziert: 01.05.2026, 11:28 - Dateigröße: 2.98 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of the Symfony package.
 005   *
 006   * (c) Fabien Potencier <fabien@symfony.com>
 007   *
 008   * For the full copyright and license information, please view the LICENSE
 009   * file that was distributed with this source code.
 010   */
 011   
 012  namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
 013   
 014  @trigger_error(sprintf('The class %s is deprecated since Symfony 3.4 and will be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.', MemcacheSessionHandler::class), \E_USER_DEPRECATED);
 015   
 016  /**
 017   * @author Drak <drak@zikula.org>
 018   *
 019   * @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler instead.
 020   */
 021  class MemcacheSessionHandler implements \SessionHandlerInterface
 022  {
 023      private $memcache;
 024   
 025      /**
 026       * @var int Time to live in seconds
 027       */
 028      private $ttl;
 029   
 030      /**
 031       * @var string Key prefix for shared environments
 032       */
 033      private $prefix;
 034   
 035      /**
 036       * Constructor.
 037       *
 038       * List of available options:
 039       *  * prefix: The prefix to use for the memcache keys in order to avoid collision
 040       *  * expiretime: The time to live in seconds
 041       *
 042       * @param \Memcache $memcache A \Memcache instance
 043       * @param array     $options  An associative array of Memcache options
 044       *
 045       * @throws \InvalidArgumentException When unsupported options are passed
 046       */
 047      public function __construct(\Memcache $memcache, array $options = [])
 048      {
 049          if ($diff = array_diff(array_keys($options), ['prefix', 'expiretime'])) {
 050              throw new \InvalidArgumentException(sprintf('The following options are not supported "%s".', implode(', ', $diff)));
 051          }
 052   
 053          $this->memcache = $memcache;
 054          $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
 055          $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
 056      }
 057   
 058      /**
 059       * {@inheritdoc}
 060       */
 061      public function open($savePath, $sessionName)
 062      {
 063          return true;
 064      }
 065   
 066      /**
 067       * {@inheritdoc}
 068       */
 069      public function close()
 070      {
 071          return true;
 072      }
 073   
 074      /**
 075       * {@inheritdoc}
 076       */
 077      public function read($sessionId)
 078      {
 079          return $this->memcache->get($this->prefix.$sessionId) ?: '';
 080      }
 081   
 082      /**
 083       * {@inheritdoc}
 084       */
 085      public function write($sessionId, $data)
 086      {
 087          return $this->memcache->set($this->prefix.$sessionId, $data, 0, time() + $this->ttl);
 088      }
 089   
 090      /**
 091       * {@inheritdoc}
 092       */
 093      public function destroy($sessionId)
 094      {
 095          $this->memcache->delete($this->prefix.$sessionId);
 096   
 097          return true;
 098      }
 099   
 100      /**
 101       * {@inheritdoc}
 102       */
 103      public function gc($maxlifetime)
 104      {
 105          // not required here because memcache will auto expire the records anyhow.
 106          return true;
 107      }
 108   
 109      /**
 110       * Return a Memcache instance.
 111       *
 112       * @return \Memcache
 113       */
 114      protected function getMemcache()
 115      {
 116          return $this->memcache;
 117      }
 118  }
 119