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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32eb66fa3e40a126e33ffcc7baab164a975355d5
4
- data.tar.gz: 4b3174e91c7ef491b84f871ba7495256a9b269ee
3
+ metadata.gz: 9af564d26f46f6d13e5c8b8aed849a53051eb35c
4
+ data.tar.gz: fce31976318c5449cdf6d49307cb5f8a188fc17e
5
5
  SHA512:
6
- metadata.gz: b83c38ff786bd5090bf8a6657850913d31a5768881d6a4c331c23d6fc066927b0611e89846a5fcee8041f9a933ae3ddf2cf05580dd9b5e25f732536f21fb5b84
7
- data.tar.gz: dd123be54e0ee6875ef223d64b75f3c5718848b32aed4dd916d8aec895c758810d3e7a789b7c3200cccb328a0f40c3feefe19ba0ca3bca6b2fb9e1ec214313ef
6
+ metadata.gz: a2668e5bba496fb1ed7d42789bab35b65803ab5caa683515417ecd4d0cf1ebd7697f4fba3e6a3585694faa7fa5b4b0897a0495824770600b71e48319446cb2eb
7
+ data.tar.gz: 7a595697c0d85351b590a7cbab948c1076c525f9ba1da42de54dd1aa2c5b70b98c4790ae07c27a18a6f1ebe8b2b00fa003d47c108459db7fa13f75c797ab2e31
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ .DS_Store
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-redis'
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
- def initialize
7
- config = YAML.load_file("./config/redis.yml")[Rails.env]
8
- if config
9
- @redis ||= Redis.new(:host => config['redis_host'], :port => config['redis_port'],
10
- namespace: config['redis_namespace'], :db => config['redis_db'])
11
- else
12
- @redis ||= Redis.new
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
- @redis.send(meth, *args, &blk)
16
+ REDISCLI.send(meth, *args, &blk)
18
17
  end
19
18
 
20
19
  end
@@ -1,7 +1,7 @@
1
1
  module Counter
2
2
  module Cache
3
3
  module Credis
4
- VERSION = "0.0.5"
4
+ VERSION = "0.0.6"
5
5
  end
6
6
  end
7
7
  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.5
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-06-16 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler