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 +4 -4
- data/.travis.yml +1 -1
- data/README.md +18 -2
- data/Rakefile +5 -1
- data/gemfiles/activerecord_3.gemfile.lock +2 -2
- data/gemfiles/activerecord_4.0.gemfile.lock +2 -2
- data/gemfiles/activerecord_4.1.gemfile.lock +48 -41
- data/lib/counter/cache/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f919c6ae2950453f8c265ef31e5f60cbe492c47
|
4
|
+
data.tar.gz: baaf7090d810fe10ced19ce76928ce5d911f250a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f800e2e2fd6dbd1c9c60a6dd9f9a91fd84f1b42960e961631e8e23ae9ed5dd849cd6b662bcecd9c46db8e0772e13c9576465c8ac0e5839552c466b3746131957
|
7
|
+
data.tar.gz: 38275d8b622ebe622e2106a1b8118a4cb89901409e740ee67611fc485479535127adb55e74b565f94b96eb478337619b2d1975a3d0306a75d679de6544050ab0
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,25 @@
|
|
1
|
-
# Counter::Cache
|
1
|
+
# Counter::Cache
|
2
2
|
|
3
|
-
[![
|
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
@@ -1,84 +1,91 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
counter-cache (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.
|
11
|
-
activesupport (= 4.1.
|
10
|
+
activemodel (4.1.14.1)
|
11
|
+
activesupport (= 4.1.14.1)
|
12
12
|
builder (~> 3.1)
|
13
|
-
activerecord (4.1.
|
14
|
-
activemodel (= 4.1.
|
15
|
-
activesupport (= 4.1.
|
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.
|
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
|
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.
|
33
|
+
ffi (1.9.10)
|
36
34
|
formatador (0.2.5)
|
37
|
-
guard (2.
|
35
|
+
guard (2.13.0)
|
38
36
|
formatador (>= 0.2.4)
|
39
|
-
listen (
|
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-
|
44
|
+
guard-compat (1.2.1)
|
45
|
+
guard-rspec (4.6.4)
|
44
46
|
guard (~> 2.1)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
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.
|
54
|
+
lumberjack (1.0.10)
|
53
55
|
method_source (0.8.2)
|
54
|
-
minitest (5.4
|
55
|
-
|
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.
|
60
|
-
rb-fsevent (0.9.
|
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.
|
64
|
-
rspec (3.
|
65
|
-
rspec-core (~> 3.
|
66
|
-
rspec-expectations (~> 3.
|
67
|
-
rspec-mocks (~> 3.
|
68
|
-
rspec-core (3.
|
69
|
-
rspec-support (~> 3.
|
70
|
-
rspec-expectations (3.0
|
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.
|
73
|
-
rspec-mocks (3.
|
74
|
-
|
75
|
-
|
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.
|
85
|
+
sqlite3 (1.3.11)
|
78
86
|
thor (0.19.1)
|
79
|
-
thread_safe (0.3.
|
80
|
-
|
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.
|
107
|
+
1.11.2
|
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.
|
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:
|
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.
|
210
|
+
rubygems_version: 2.5.1
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Counting is hard.
|