stanley-king před 4 roky
rodič
revize
bcd956b935

+ 10 - 2
core/framework/cache/cache.redis.php

@@ -164,7 +164,7 @@ class CacheRedis extends Cache
                 $value[1] = str_replace(' ', '', $value[1]);
                 preg_match('/^[A-Za-z_]+([+-]\d+(\.\d+)?)$/',$value[1],$matches);
                 if (is_numeric($matches[1])) {
-                    $this->hIncrBy($name, $prefix, $key, $matches[1]);
+                    $this->hIncrByFloat($name, $prefix, $key, $matches[1]);
                 }
                 unset($data[$key]);
             }
@@ -210,7 +210,15 @@ class CacheRedis extends Cache
         }
     }
 
-    public function hIncrBy($name, $prefix, $key, $num = 1) {
+    public function hIncrBy($name, $key, $value)
+    {
+        $this->init_master();
+        if (!$this->enable) return false;
+
+        return $this->handler->hIncrBy($this->_key($name), $key, $value);
+    }
+
+    public function hIncrByFloat($name, $prefix, $key, $num = 1) {
         if ($this->hget($name, $prefix,$key) !== false) {
             $this->handler->hIncrByFloat($this->_key($name), $key, floatval($num));
         }

+ 1 - 1
helper/refill/policy/ctl_item.php

@@ -69,7 +69,7 @@ class ctl_item
     {
         $this->load($this->mLastReadTime);
         $speed = array_sum($this->mRecords);
-        Log::record("{$this->mPrefix} = {$speed}  max_speed={$this->mMaxSpeed}",Log::DEBUG);
+        Log::record("{$this->mPrefix} = {$speed} max_speed={$this->mMaxSpeed}",Log::DEBUG);
 
         return $speed;
     }

+ 4 - 0
test/TestRedis.php

@@ -139,6 +139,10 @@ class TestRedis extends TestCase
         $t = current(['1000119000003695610' => time()]);
         wcache("card_expired",['1000119000003695610' => time()],'');
         $x = rcache('card_expired','','1000119000003695610');
+    }
+
+    public function testSpeed()
+    {
 
     }