counter-cache 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cac236244f5fa2812dc3ba95405240ff016fce4
4
- data.tar.gz: e2281ca37f31cc531cb2bba1aa1f9ec3438ca5d1
3
+ metadata.gz: 2f919c6ae2950453f8c265ef31e5f60cbe492c47
4
+ data.tar.gz: baaf7090d810fe10ced19ce76928ce5d911f250a
5
5
  SHA512:
6
- metadata.gz: 38f9a282a897f6790147ea80dd9198db5bf27fb39aeec1339916480297a02182d1e11066304ef674339103070f0d6bc874f0d3ef0f3f1d19bcff59389e339941
7
- data.tar.gz: afc080f77508a700108aa7ea37687a5c509633efd2048c693b60a3fa2894f52e5b6b2ebd358e0ebd7578d6006b5ac7ec81474ad13d45c724824600ce3290c422
6
+ metadata.gz: f800e2e2fd6dbd1c9c60a6dd9f9a91fd84f1b42960e961631e8e23ae9ed5dd849cd6b662bcecd9c46db8e0772e13c9576465c8ac0e5839552c466b3746131957
7
+ data.tar.gz: 38275d8b622ebe622e2106a1b8118a4cb89901409e740ee67611fc485479535127adb55e74b565f94b96eb478337619b2d1975a3d0306a75d679de6544050ab0
@@ -1,6 +1,6 @@
1
1
  rvm:
2
- - "1.9.3"
3
2
  - "2.1.1"
3
+ - "2.3.0"
4
4
  gemfile:
5
5
  - gemfiles/activerecord_3.gemfile
6
6
  - gemfiles/activerecord_4.0.gemfile
data/README.md CHANGED
@@ -1,9 +1,25 @@
1
- # Counter::Cache
1
+ # Counter::Cache
2
2
 
3
- [![Build Status](https://travis-ci.org/wanelo/counter-cache.svg?branch=master)](https://travis-ci.org/wanelo/counter-cache)
3
+ [![Gem Version](https://badge.fury.io/rb/counter-cache.png)](http://badge.fury.io/rb/ventable)
4
+ [![Build Status](https://travis-ci.org/wanelo/counter-cache.svg?branch=master&fl)](https://travis-ci.org/wanelo/counter-cache)
5
+ [![Code Climate](https://codeclimate.com/github/wanelo/counter-cache.png)](https://codeclimate.com/github/wanelo/counter-cache)
4
6
 
5
7
  Counting things is hard, counting them at scale is even harder, so control when things are counted.
6
8
 
9
+ Any time your application performs pagination, the underlying library probably issues a `select count(*) from ...`
10
+ request to the database, because all paginators need to know how many pages there are. This works on a small-to-medium
11
+ dataset, and in an application with relatively low web traffic. But at high traffic volume, live counts saturate CPU on the
12
+ database server. This is because sorting typically happens on CPU of the database server, using a small amount of heap
13
+ RAM or even worse — using temp files, which grinds the disk IO to a hault. Web requests become slower and
14
+ slower, start to pile up in various queues, and eventually saturate all of the app servers.
15
+ There you are, the site is down.
16
+
17
+ This gem provides a solution that works at scale, and will help you keep your site up.
18
+
19
+ This library is battle-tested at Wanelo, where it has been running for several years.
20
+
21
+ ### Overview
22
+
7
23
  [Rails Counter Caches](http://railscasts.com/episodes/23-counter-cache-column) are a convenient way to keep counters on
8
24
  models that have many children. Without them, you always do live counts, which do not scale. But at high scale, Rails
9
25
  counter caches create update contention on singe models, especially for social sites where any single model might become
data/Rakefile CHANGED
@@ -2,5 +2,9 @@ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
-
6
5
  task :default => :spec
6
+ task :all do
7
+ sh 'bundle exec appraisal install'
8
+ sh 'bundle exec appraisal rspec'
9
+ end
10
+
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- counter-cache (0.1.0)
4
+ counter-cache (0.3.0)
5
5
  activerecord (>= 3.0)
6
6
 
7
7
  GEM
@@ -92,4 +92,4 @@ DEPENDENCIES
92
92
  sqlite3
93
93
 
94
94
  BUNDLED WITH
95
- 1.10.6
95
+ 1.11.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- counter-cache (0.1.0)
4
+ counter-cache (0.3.0)
5
5
  activerecord (>= 3.0)
6
6
 
7
7
  GEM
@@ -98,4 +98,4 @@ DEPENDENCIES
98
98
  sqlite3
99
99
 
100
100
  BUNDLED WITH
101
- 1.10.6
101
+ 1.11.2
@@ -1,84 +1,91 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- counter-cache (0.1.0)
4
+ counter-cache (0.3.0)
5
5
  activerecord (>= 3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.1.4)
11
- activesupport (= 4.1.4)
10
+ activemodel (4.1.14.1)
11
+ activesupport (= 4.1.14.1)
12
12
  builder (~> 3.1)
13
- activerecord (4.1.4)
14
- activemodel (= 4.1.4)
15
- activesupport (= 4.1.4)
13
+ activerecord (4.1.14.1)
14
+ activemodel (= 4.1.14.1)
15
+ activesupport (= 4.1.14.1)
16
16
  arel (~> 5.0.0)
17
- activesupport (4.1.4)
17
+ activesupport (4.1.14.1)
18
18
  i18n (~> 0.6, >= 0.6.9)
19
19
  json (~> 1.7, >= 1.7.7)
20
20
  minitest (~> 5.1)
21
21
  thread_safe (~> 0.1)
22
22
  tzinfo (~> 1.1)
23
- appraisal (1.0.0)
23
+ appraisal (2.1.0)
24
24
  bundler
25
25
  rake
26
26
  thor (>= 0.14.0)
27
27
  arel (5.0.1.20140414130214)
28
28
  builder (3.2.2)
29
- celluloid (0.15.2)
30
- timers (~> 1.1.0)
31
29
  coderay (1.1.0)
32
30
  diff-lcs (1.2.5)
33
31
  fakeredis (0.5.0)
34
32
  redis (~> 3.0)
35
- ffi (1.9.3)
33
+ ffi (1.9.10)
36
34
  formatador (0.2.5)
37
- guard (2.6.1)
35
+ guard (2.13.0)
38
36
  formatador (>= 0.2.4)
39
- listen (~> 2.7)
37
+ listen (>= 2.7, <= 4.0)
40
38
  lumberjack (~> 1.0)
39
+ nenv (~> 0.1)
40
+ notiffany (~> 0.0)
41
41
  pry (>= 0.9.12)
42
+ shellany (~> 0.0)
42
43
  thor (>= 0.18.1)
43
- guard-rspec (4.3.1)
44
+ guard-compat (1.2.1)
45
+ guard-rspec (4.6.4)
44
46
  guard (~> 2.1)
45
- rspec (>= 2.14, < 4.0)
46
- i18n (0.6.11)
47
- json (1.8.1)
48
- listen (2.7.9)
49
- celluloid (>= 0.15.2)
47
+ guard-compat (~> 1.1)
48
+ rspec (>= 2.99.0, < 4.0)
49
+ i18n (0.7.0)
50
+ json (1.8.3)
51
+ listen (3.0.5)
50
52
  rb-fsevent (>= 0.9.3)
51
53
  rb-inotify (>= 0.9)
52
- lumberjack (1.0.9)
54
+ lumberjack (1.0.10)
53
55
  method_source (0.8.2)
54
- minitest (5.4.0)
55
- pry (0.10.0)
56
+ minitest (5.8.4)
57
+ nenv (0.2.0)
58
+ notiffany (0.0.8)
59
+ nenv (~> 0.1)
60
+ shellany (~> 0.0)
61
+ pry (0.10.3)
56
62
  coderay (~> 1.1.0)
57
63
  method_source (~> 0.8.1)
58
64
  slop (~> 3.4)
59
- rake (10.3.2)
60
- rb-fsevent (0.9.4)
65
+ rake (10.5.0)
66
+ rb-fsevent (0.9.7)
61
67
  rb-inotify (0.9.5)
62
68
  ffi (>= 0.5.0)
63
- redis (3.1.0)
64
- rspec (3.0.0)
65
- rspec-core (~> 3.0.0)
66
- rspec-expectations (~> 3.0.0)
67
- rspec-mocks (~> 3.0.0)
68
- rspec-core (3.0.3)
69
- rspec-support (~> 3.0.0)
70
- rspec-expectations (3.0.3)
69
+ redis (3.2.2)
70
+ rspec (3.4.0)
71
+ rspec-core (~> 3.4.0)
72
+ rspec-expectations (~> 3.4.0)
73
+ rspec-mocks (~> 3.4.0)
74
+ rspec-core (3.4.2)
75
+ rspec-support (~> 3.4.0)
76
+ rspec-expectations (3.4.0)
71
77
  diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.0.0)
73
- rspec-mocks (3.0.3)
74
- rspec-support (~> 3.0.0)
75
- rspec-support (3.0.3)
78
+ rspec-support (~> 3.4.0)
79
+ rspec-mocks (3.4.1)
80
+ diff-lcs (>= 1.2.0, < 2.0)
81
+ rspec-support (~> 3.4.0)
82
+ rspec-support (3.4.1)
83
+ shellany (0.0.1)
76
84
  slop (3.6.0)
77
- sqlite3 (1.3.9)
85
+ sqlite3 (1.3.11)
78
86
  thor (0.19.1)
79
- thread_safe (0.3.4)
80
- timers (1.1.0)
81
- tzinfo (1.2.1)
87
+ thread_safe (0.3.5)
88
+ tzinfo (1.2.2)
82
89
  thread_safe (~> 0.1)
83
90
 
84
91
  PLATFORMS
@@ -97,4 +104,4 @@ DEPENDENCIES
97
104
  sqlite3
98
105
 
99
106
  BUNDLED WITH
100
- 1.10.6
107
+ 1.11.2
@@ -1,5 +1,5 @@
1
1
  module Counter
2
2
  module Cache
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: counter-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Henry & Matt Camuto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  version: '0'
208
208
  requirements: []
209
209
  rubyforge_project:
210
- rubygems_version: 2.2.3
210
+ rubygems_version: 2.5.1
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: Counting is hard.