counter-cache-credis 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +3 -1
- data/lib/counter/cache/credis/redis_cli.rb +8 -9
- data/lib/counter/cache/credis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9af564d26f46f6d13e5c8b8aed849a53051eb35c
|
|
4
|
+
data.tar.gz: fce31976318c5449cdf6d49307cb5f8a188fc17e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2668e5bba496fb1ed7d42789bab35b65803ab5caa683515417ecd4d0cf1ebd7697f4fba3e6a3585694faa7fa5b4b0897a0495824770600b71e48319446cb2eb
|
|
7
|
+
data.tar.gz: 7a595697c0d85351b590a7cbab948c1076c525f9ba1da42de54dd1aa2c5b70b98c4790ae07c27a18a6f1ebe8b2b00fa003d47c108459db7fa13f75c797ab2e31
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Set a counter for model through redis in order to improve perfomance.
|
|
|
7
7
|
Add this line to your application's Gemfile:
|
|
8
8
|
|
|
9
9
|
```ruby
|
|
10
|
-
gem 'counter-cache-
|
|
10
|
+
gem 'counter-cache-credis'
|
|
11
11
|
gem 'redis'
|
|
12
12
|
```
|
|
13
13
|
|
|
@@ -60,6 +60,8 @@ end
|
|
|
60
60
|
student = Student.first
|
|
61
61
|
# It will increase itself by one
|
|
62
62
|
student.increase_counter
|
|
63
|
+
# increase selected column
|
|
64
|
+
student.increase_counter(:hello_count)
|
|
63
65
|
# It will reduce itself by one
|
|
64
66
|
student.reduce_counter
|
|
65
67
|
# get views_count through redis
|
|
@@ -3,18 +3,17 @@ module Counter
|
|
|
3
3
|
module Credis
|
|
4
4
|
class RedisCli
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
end
|
|
6
|
+
config = YAML.load_file("./config/redis.yml")[Rails.env]
|
|
7
|
+
|
|
8
|
+
if config
|
|
9
|
+
REDISCLI = Redis.new(:host => config['redis_host'], :port => config['redis_port'],
|
|
10
|
+
namespace: config['redis_namespace'], :db => config['redis_db'])
|
|
11
|
+
else
|
|
12
|
+
REDISCLI = Redis.new
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
def method_missing(meth, *args, &blk)
|
|
17
|
-
|
|
16
|
+
REDISCLI.send(meth, *args, &blk)
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: counter-cache-credis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- linjunzhu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|