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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
MemcacheProfilerStorage.php
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\HttpKernel\Profiler;
013
014 @trigger_error('The '.__NAMESPACE__.'\MemcacheProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
015
016 /**
017 * Memcache Profiler Storage.
018 *
019 * @author Andrej Hudec <pulzarraider@gmail.com>
020 *
021 * @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
022 * Use {@link FileProfilerStorage} instead.
023 */
024 class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
025 {
026 /**
027 * @var \Memcache
028 */
029 private $memcache;
030
031 /**
032 * Internal convenience method that returns the instance of the Memcache.
033 *
034 * @return \Memcache
035 *
036 * @throws \RuntimeException
037 */
038 protected function getMemcache()
039 {
040 if (null === $this->memcache) {
041 if (!preg_match('#^memcache://(?(?=\[.*\])\[(.*)\]|(.*)):(.*)$#', $this->dsn, $matches)) {
042 throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Memcache with an invalid dsn "%s". The expected format is "memcache://[host]:port".', $this->dsn));
043 }
044
045 $host = $matches[1] ?: $matches[2];
046 $port = $matches[3];
047
048 $memcache = new \Memcache();
049 $memcache->addserver($host, $port);
050
051 $this->memcache = $memcache;
052 }
053
054 return $this->memcache;
055 }
056
057 /**
058 * Set instance of the Memcache.
059 *
060 * @param \Memcache $memcache
061 */
062 public function setMemcache($memcache)
063 {
064 $this->memcache = $memcache;
065 }
066
067 /**
068 * {@inheritdoc}
069 */
070 protected function getValue($key)
071 {
072 return $this->getMemcache()->get($key);
073 }
074
075 /**
076 * {@inheritdoc}
077 */
078 protected function setValue($key, $value, $expiration = 0)
079 {
080 return $this->getMemcache()->set($key, $value, false, time() + $expiration);
081 }
082
083 /**
084 * {@inheritdoc}
085 */
086 protected function delete($key)
087 {
088 return $this->getMemcache()->delete($key);
089 }
090
091 /**
092 * {@inheritdoc}
093 */
094 protected function appendValue($key, $value, $expiration = 0)
095 {
096 $memcache = $this->getMemcache();
097
098 if (method_exists($memcache, 'append')) {
099 // Memcache v3.0
100 if (!$result = $memcache->append($key, $value, false, $expiration)) {
101 return $memcache->set($key, $value, false, $expiration);
102 }
103
104 return $result;
105 }
106
107 // simulate append in Memcache <3.0
108 $content = $memcache->get($key);
109
110 return $memcache->set($key, $content.$value, false, $expiration);
111 }
112 }
113