counter-cache-credis 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/counter/cache/credis/counter.rb +2 -1
- data/lib/counter/cache/credis/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0659026d81d19b19e71bbf5120cac135877778b2
|
4
|
+
data.tar.gz: 5cb0f7319b034f61a185d24b29ef570662e8592c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30978b4e3e69c1d6a339ebf0e8f628e316fc9bb0638d5d71004dcd508e9b0501664c3eb7f1297b1b9b8b41519e8ef3412cd1599c279f34fdc678b2fa57ec4a71
|
7
|
+
data.tar.gz: 68931ac0e8975c3436bf66c7a466ff7787e319b3f6e27c3ad8e3548be8424e58a73ccff38001b34c8cd236da7f9dae7e33b7858e3de217305086b3bee7d5880e
|
@@ -11,7 +11,7 @@ module Counter
|
|
11
11
|
def defind_column_getter(column)
|
12
12
|
self.class_eval do
|
13
13
|
define_method("get_#{column}_cache") do
|
14
|
-
self.send(column) +
|
14
|
+
self.send(column) + RedisCli.new.get("#{self.class.table_name}/#{column}#{self.id}").to_i
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -33,6 +33,7 @@ module Counter
|
|
33
33
|
# 修改值
|
34
34
|
def update_counter(column = 'views_count')
|
35
35
|
redis = RedisCli.new
|
36
|
+
p redis
|
36
37
|
views_count_redis = redis.get("#{self.class.table_name}/#{column}#{self.id}").to_i
|
37
38
|
views_count_redis = 0 if !views_count_redis
|
38
39
|
views_count_redis += 1
|