]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Cache/MemcachedCacheDriver.php
Line feeds fixed, not change in functionality
[friendica.git] / src / Core / Cache / MemcachedCacheDriver.php
index 1a8bdc95030bed39152c57128bc17dd650cb5bc0..d6b8d4ad5808146d00d9b8110c30770eaf019834 100644 (file)
@@ -1,68 +1,68 @@
-<?php\r
-\r
-namespace Friendica\Core\Cache;\r
-\r
-use Friendica\BaseObject;\r
-use Friendica\Core\Cache;\r
-\r
-/**\r
- * Memcached Cache Driver\r
- *\r
- * @author Hypolite Petovan <mrpetovan@gmail.com>\r
- */\r
-class MemcachedCacheDriver extends BaseObject implements ICacheDriver\r
-{\r
-       /**\r
-        * @var Memcached\r
-        */\r
-       private $memcached;\r
-\r
-       public function __construct(array $memcached_hosts)\r
-       {\r
-               if (!class_exists('Memcached', false)) {\r
-                       throw new \Exception('Memcached class isn\'t available');\r
-               }\r
-\r
-               $this->memcached = new \Memcached();\r
-\r
-               $this->memcached->addServers($memcached_hosts);\r
-\r
-               if (count($this->memcached->getServerList()) == 0) {\r
-                       throw new \Exception('Expected Memcached servers aren\'t available, config:' . var_export($memcached_hosts, true));\r
-               }\r
-       }\r
-\r
-       public function get($key)\r
-       {\r
-               $return = null;\r
-\r
-               // We fetch with the hostname as key to avoid problems with other applications\r
-               $value = $this->memcached->get(self::getApp()->get_hostname() . ':' . $key);\r
-\r
-               if ($this->memcached->getResultCode() === \Memcached::RES_SUCCESS) {\r
-                       $return = $value;\r
-               }\r
-\r
-               return $return;\r
-       }\r
-\r
-       public function set($key, $value, $duration = Cache::MONTH)\r
-       {\r
-               // We store with the hostname as key to avoid problems with other applications\r
-               return $this->memcached->set(\r
-                       self::getApp()->get_hostname() . ":" . $key,\r
-                       $value,\r
-                       time() + $duration\r
-               );\r
-       }\r
-\r
-       public function delete($key)\r
-       {\r
-               return $this->memcached->delete($key);\r
-       }\r
-\r
-       public function clear()\r
-       {\r
-               return true;\r
-       }\r
-}\r
+<?php
+
+namespace Friendica\Core\Cache;
+
+use Friendica\BaseObject;
+use Friendica\Core\Cache;
+
+/**
+ * Memcached Cache Driver
+ *
+ * @author Hypolite Petovan <mrpetovan@gmail.com>
+ */
+class MemcachedCacheDriver extends BaseObject implements ICacheDriver
+{
+       /**
+        * @var Memcached
+        */
+       private $memcached;
+
+       public function __construct(array $memcached_hosts)
+       {
+               if (!class_exists('Memcached', false)) {
+                       throw new \Exception('Memcached class isn\'t available');
+               }
+
+               $this->memcached = new \Memcached();
+
+               $this->memcached->addServers($memcached_hosts);
+
+               if (count($this->memcached->getServerList()) == 0) {
+                       throw new \Exception('Expected Memcached servers aren\'t available, config:' . var_export($memcached_hosts, true));
+               }
+       }
+
+       public function get($key)
+       {
+               $return = null;
+
+               // We fetch with the hostname as key to avoid problems with other applications
+               $value = $this->memcached->get(self::getApp()->get_hostname() . ':' . $key);
+
+               if ($this->memcached->getResultCode() === \Memcached::RES_SUCCESS) {
+                       $return = $value;
+               }
+
+               return $return;
+       }
+
+       public function set($key, $value, $duration = Cache::MONTH)
+       {
+               // We store with the hostname as key to avoid problems with other applications
+               return $this->memcached->set(
+                       self::getApp()->get_hostname() . ":" . $key,
+                       $value,
+                       time() + $duration
+               );
+       }
+
+       public function delete($key)
+       {
+               return $this->memcached->delete($key);
+       }
+
+       public function clear()
+       {
+               return true;
+       }
+}