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 |
MemcachedProfilerStorage.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__.'\MemcachedProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
015
016 /**
017 * Memcached 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 MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
025 {
026 /**
027 * @var \Memcached
028 */
029 private $memcached;
030
031 /**
032 * Internal convenience method that returns the instance of the Memcached.
033 *
034 * @return \Memcached
035 *
036 * @throws \RuntimeException
037 */
038 protected function getMemcached()
039 {
040 if (null === $this->memcached) {
041 if (!preg_match('#^memcached://(?(?=\[.*\])\[(.*)\]|(.*)):(.*)$#', $this->dsn, $matches)) {
042 throw new \RuntimeException(sprintf('Please check your configuration. You are trying to use Memcached with an invalid dsn "%s". The expected format is "memcached://[host]:port".', $this->dsn));
043 }
044
045 $host = $matches[1] ?: $matches[2];
046 $port = $matches[3];
047
048 $memcached = new \Memcached();
049
050 // disable compression to allow appending
051 $memcached->setOption(\Memcached::OPT_COMPRESSION, false);
052
053 $memcached->addServer($host, $port);
054
055 $this->memcached = $memcached;
056 }
057
058 return $this->memcached;
059 }
060
061 /**
062 * Set instance of the Memcached.
063 *
064 * @param \Memcached $memcached
065 */
066 public function setMemcached($memcached)
067 {
068 $this->memcached = $memcached;
069 }
070
071 /**
072 * {@inheritdoc}
073 */
074 protected function getValue($key)
075 {
076 return $this->getMemcached()->get($key);
077 }
078
079 /**
080 * {@inheritdoc}
081 */
082 protected function setValue($key, $value, $expiration = 0)
083 {
084 return $this->getMemcached()->set($key, $value, time() + $expiration);
085 }
086
087 /**
088 * {@inheritdoc}
089 */
090 protected function delete($key)
091 {
092 return $this->getMemcached()->delete($key);
093 }
094
095 /**
096 * {@inheritdoc}
097 */
098 protected function appendValue($key, $value, $expiration = 0)
099 {
100 $memcached = $this->getMemcached();
101
102 if (!$result = $memcached->append($key, $value)) {
103 return $memcached->set($key, $value, $expiration);
104 }
105
106 return $result;
107 }
108 }
109