code review by fei.hong: do modify add the second grade cache check when call ap…
…i error increment five times set data to first grade cache
Showing
1 changed file
with
2 additions
and
1 deletions
@@ -76,9 +76,10 @@ class Cache | @@ -76,9 +76,10 @@ class Cache | ||
76 | if ($node === 'slave') { | 76 | if ($node === 'slave') { |
77 | $incrementKey = self::makeKey('_increment_' . $key, 'slave'); | 77 | $incrementKey = self::makeKey('_increment_' . $key, 'slave'); |
78 | $incrementValue = HoodCache::Memcached('slave')->get($incrementKey, 'slave'); | 78 | $incrementValue = HoodCache::Memcached('slave')->get($incrementKey, 'slave'); |
79 | - // 接口调用失败累计5次之后,回填二级缓存数据到一级缓存 | 79 | + // 接口调用失败累计5次之后,回填二级缓存数据到一级缓存, 重置计数值为0 |
80 | if (is_int($incrementValue) && $incrementValue > 5) { | 80 | if (is_int($incrementValue) && $incrementValue > 5) { |
81 | HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $result, 300); | 81 | HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $result, 300); |
82 | + HoodCache::Memcached('slave')->set($incrementKey, 0, 3600); | ||
82 | } | 83 | } |
83 | // 接口调用失败次数累加 | 84 | // 接口调用失败次数累加 |
84 | else { | 85 | else { |
-
Please register or login to post a comment