]> git.mxchange.org Git - friendica.git/commitdiff
Improve doc blocks in cache drivers
authorHypolite Petovan <mrpetovan@gmail.com>
Wed, 26 Sep 2018 02:51:41 +0000 (22:51 -0400)
committerHypolite Petovan <mrpetovan@gmail.com>
Wed, 26 Sep 2018 02:51:41 +0000 (22:51 -0400)
src/Core/Cache/DatabaseCacheDriver.php
src/Core/Cache/MemcacheCacheDriver.php
src/Core/Cache/MemcachedCacheDriver.php
src/Core/Cache/RedisCacheDriver.php

index ca4842a4686db98247fa41fb19bf06da3ffa11de..58769165d148ae6b419f873b8ecbc534b740c6b0 100644 (file)
@@ -13,6 +13,9 @@ use Friendica\Util\DateTimeFormat;
  */
 class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
 {
+       /**
+        * (@inheritdoc)
+        */
        public function get($key)
        {
                $cache = DBA::selectFirst('cache', ['v'], ['`k` = ? AND `expires` >= ?', $key, DateTimeFormat::utcNow()]);
@@ -32,6 +35,9 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
                return null;
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function set($key, $value, $ttl = Cache::FIVE_MINUTES)
        {
                $fields = [
@@ -43,11 +49,17 @@ class DatabaseCacheDriver extends AbstractCacheDriver implements ICacheDriver
                return DBA::update('cache', $fields, ['k' => $key], true);
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function delete($key)
        {
                return DBA::delete('cache', ['k' => $key]);
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function clear($outdated = true)
        {
                if ($outdated) {
index 4ca5aa38db066c3ed35c2a0b5ac132eeb8f30620..37327ebba92e9d6230b6a5be588682d117f802fa 100644 (file)
@@ -22,6 +22,11 @@ class MemcacheCacheDriver extends AbstractCacheDriver implements IMemoryCacheDri
         */
        private $memcache;
 
+       /**
+        * @param string $memcache_host
+        * @param int    $memcache_port
+        * @throws Exception
+        */
        public function __construct($memcache_host, $memcache_port)
        {
                if (!class_exists('Memcache', false)) {
index 9e9c00f0b89f25f9ffbc943ccce6aa7f4673dec2..3bf82a18209ede2df054889e35ef869ca0cfc67c 100644 (file)
@@ -53,6 +53,9 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
                }
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function get($key)
        {
                $return = null;
@@ -68,6 +71,9 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
                return $return;
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function set($key, $value, $ttl = Cache::FIVE_MINUTES)
        {
                $cachekey = $this->getCacheKey($key);
@@ -88,12 +94,18 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
 
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function delete($key)
        {
                $cachekey = $this->getCacheKey($key);
                return $this->memcached->delete($cachekey);
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function clear($outdated = true)
        {
                if ($outdated) {
@@ -104,12 +116,7 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
        }
 
        /**
-        * @brief Sets a value if it's not already stored
-        *
-        * @param string $key      The cache key
-        * @param mixed  $value    The old value we know from the cache
-        * @param int    $ttl      The cache lifespan, must be one of the Cache constants
-        * @return bool
+        * (@inheritdoc)
         */
        public function add($key, $value, $ttl = Cache::FIVE_MINUTES)
        {
index 2c2a3e5d7cb27a99bc896f8816f8ed5571efc475..cd5d8d9bfeef4f82924014eaf3d9b4836af48fb6 100644 (file)
@@ -20,6 +20,11 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
         */
        private $redis;
 
+       /**
+        * @param string $redis_host
+        * @param int    $redis_port
+        * @throws Exception
+        */
        public function __construct($redis_host, $redis_port)
        {
                if (!class_exists('Redis', false)) {
@@ -33,6 +38,9 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
                }
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function get($key)
        {
                $return = null;
@@ -55,6 +63,9 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
                return $return;
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function set($key, $value, $ttl = Cache::FIVE_MINUTES)
        {
                $cachekey = $this->getCacheKey($key);
@@ -75,12 +86,18 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
                }
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function delete($key)
        {
                $cachekey = $this->getCacheKey($key);
                return ($this->redis->delete($cachekey) > 0);
        }
 
+       /**
+        * (@inheritdoc)
+        */
        public function clear($outdated = true)
        {
                if ($outdated) {
@@ -127,6 +144,7 @@ class RedisCacheDriver extends AbstractCacheDriver implements IMemoryCacheDriver
                $this->redis->unwatch();
                return false;
        }
+
        /**
         * (@inheritdoc)
         */