Merge pull request #1685 from Stricted/patch3_1
authorAlexander Ebert <ebert@woltlab.com>
Wed, 12 Mar 2014 15:45:18 +0000 (16:45 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 12 Mar 2014 15:45:18 +0000 (16:45 +0100)
update getTTL method

wcfsetup/install/files/lib/system/cache/source/MemcachedCacheSource.class.php

index 79bd60383cecfd4a949b5ab7391cda3756daf579..8217336fd71eb736169c103290795a0d8374bbde 100644 (file)
@@ -224,17 +224,8 @@ class MemcachedCacheSource implements ICacheSource {
         * @return      integer
         */
        protected function getTTL($maxLifetime = 0) {
-               if ($maxLifetime) {
-                       // max lifetime is a timestamp -> http://www.php.net/manual/en/memcached.expiration.php
-                       if ($maxLifetime > (60 * 60 * 24 * 30)) {
-                               // timestamp is in the past, discard
-                               if ($maxLifetime < TIME_NOW) {
-                                       $maxLifetime = 0;
-                               }
-                       }
-               }
-               
-               if ($maxLifetime) {
+               // max lifetime is a timestamp -> http://www.php.net/manual/en/memcached.expiration.php
+               if ($maxLifetime && ($maxLifetime <= (60 * 60 * 24 * 30) || $maxLifetime >= TIME_NOW)) {
                        return $maxLifetime;
                }