scoped_cache_keys 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +35 -30
- data/Readme.md +9 -6
- data/lib/scoped_cache_keys/version.rb +1 -1
- data/lib/scoped_cache_keys.rb +2 -2
- metadata +22 -43
- data/.travis.yml +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b96bac82675a12d0d185510840185d0829a897d4f08242ccf94922cfa45d1afd
|
4
|
+
data.tar.gz: 87efd06a51cf71fb41d3b8193ed8f5f56378951101c8ffa341910e82e26c2386
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a62968c83bfddb74ad349eaf0865700e65186bbc28bdcfdefbf156dfb00956e2b611ff0a2f5c4ca9b92653fb0442b2f99f91ef6908b33cf6bef7f035b941e96d
|
7
|
+
data.tar.gz: 3eb0de9f214f5855fc0d21cd3bbe1b8e504f68d428f92902ffbd6ea96895d12990cc275087e14eefc24fd595f5bb593fada8c27c8d1c676c3b91c350d612b90c
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.ruby-version
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,39 +1,41 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
scoped_cache_keys (0.
|
4
|
+
scoped_cache_keys (0.2.0)
|
5
5
|
|
6
6
|
GEM
|
7
|
-
remote:
|
7
|
+
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (
|
10
|
-
activesupport (=
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rake (0.
|
26
|
-
rspec (2.
|
27
|
-
rspec-core (~> 2.
|
28
|
-
rspec-expectations (~> 2.
|
29
|
-
rspec-mocks (~> 2.
|
30
|
-
rspec-core (2.
|
31
|
-
rspec-expectations (2.
|
32
|
-
diff-lcs (
|
33
|
-
rspec-mocks (2.
|
34
|
-
sqlite3 (1.3
|
35
|
-
|
36
|
-
|
9
|
+
activemodel (7.0.4)
|
10
|
+
activesupport (= 7.0.4)
|
11
|
+
activerecord (7.0.4)
|
12
|
+
activemodel (= 7.0.4)
|
13
|
+
activesupport (= 7.0.4)
|
14
|
+
activesupport (7.0.4)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
concurrent-ruby (1.1.10)
|
20
|
+
diff-lcs (1.5.0)
|
21
|
+
i18n (1.12.0)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
mini_portile2 (2.8.0)
|
24
|
+
minitest (5.16.3)
|
25
|
+
rake (13.0.6)
|
26
|
+
rspec (2.99.0)
|
27
|
+
rspec-core (~> 2.99.0)
|
28
|
+
rspec-expectations (~> 2.99.0)
|
29
|
+
rspec-mocks (~> 2.99.0)
|
30
|
+
rspec-core (2.99.2)
|
31
|
+
rspec-expectations (2.99.2)
|
32
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
33
|
+
rspec-mocks (2.99.4)
|
34
|
+
sqlite3 (1.5.3)
|
35
|
+
mini_portile2 (~> 2.8.0)
|
36
|
+
timecop (0.9.5)
|
37
|
+
tzinfo (2.0.5)
|
38
|
+
concurrent-ruby (~> 1.0)
|
37
39
|
|
38
40
|
PLATFORMS
|
39
41
|
ruby
|
@@ -45,3 +47,6 @@ DEPENDENCIES
|
|
45
47
|
scoped_cache_keys!
|
46
48
|
sqlite3
|
47
49
|
timecop
|
50
|
+
|
51
|
+
BUNDLED WITH
|
52
|
+
2.3.12
|
data/Readme.md
CHANGED
@@ -2,24 +2,27 @@ Add scoped_cache_key / expire_scoped_cache_key to your models for caching/sweepi
|
|
2
2
|
|
3
3
|
Install
|
4
4
|
=======
|
5
|
-
sudo gem install scoped_cache_keys
|
6
|
-
Or
|
7
5
|
|
8
|
-
|
6
|
+
```bash
|
7
|
+
gem "scoped_cache_keys"
|
8
|
+
```
|
9
9
|
|
10
10
|
Usage
|
11
11
|
=====
|
12
12
|
|
13
13
|
Gives you a key that will change whenever expire_scoped_cache_key is called.
|
14
14
|
|
15
|
+
```
|
15
16
|
<% cache user.scoped_cache_key :products do %>
|
16
17
|
... user.products.each ...
|
17
18
|
<% end %>
|
18
19
|
|
19
|
-
<% cache "something-else-" + user.scoped_cache_key
|
20
|
+
<% cache "something-else-" + user.scoped_cache_key(:products) do %>
|
20
21
|
... will also be expired ...
|
21
22
|
<% end %>
|
23
|
+
```
|
22
24
|
|
25
|
+
```ruby
|
23
26
|
# app/sweepers/product_sweeper.rb
|
24
27
|
class ProductSweeper < ActionController::Caching::Sweeper
|
25
28
|
observe Product
|
@@ -28,10 +31,10 @@ Gives you a key that will change whenever expire_scoped_cache_key is called.
|
|
28
31
|
record.user.expire_scoped_cache_key :products
|
29
32
|
end
|
30
33
|
end
|
34
|
+
```
|
31
35
|
|
32
36
|
Author
|
33
37
|
======
|
34
38
|
[Zendesk](http://zendesk.com)<br/>
|
35
39
|
michael@grosser.it<br/>
|
36
|
-
License: MIT
|
37
|
-
[![Build Status](https://secure.travis-ci.org/grosser/scoped_cache_keys.png)](http://travis-ci.org/grosser/scoped_cache_keys)
|
40
|
+
License: MIT
|
data/lib/scoped_cache_keys.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'scoped_cache_keys/version'
|
2
2
|
|
3
3
|
module ScopedCacheKeys
|
4
|
-
def scoped_cache_key(scope)
|
5
|
-
base_key = Rails.cache.fetch(build_scoped_cache_key([scope])){ Time.now.to_f }
|
4
|
+
def scoped_cache_key(scope, options = nil)
|
5
|
+
base_key = Rails.cache.fetch(build_scoped_cache_key([scope]), options) { Time.now.to_f }
|
6
6
|
build_scoped_cache_key [scope, base_key]
|
7
7
|
end
|
8
8
|
|
metadata
CHANGED
@@ -1,33 +1,22 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoped_cache_keys
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Michael Grosser
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-05-04 00:00:00 Z
|
11
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description:
|
22
14
|
email: michael@grosser.it
|
23
15
|
executables: []
|
24
|
-
|
25
16
|
extensions: []
|
26
|
-
|
27
17
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
|
30
|
-
- .travis.yml
|
18
|
+
files:
|
19
|
+
- ".gitignore"
|
31
20
|
- Gemfile
|
32
21
|
- Gemfile.lock
|
33
22
|
- Rakefile
|
@@ -38,37 +27,27 @@ files:
|
|
38
27
|
- spec/scoped_cache_keys_spec.rb
|
39
28
|
- spec/spec_helper.rb
|
40
29
|
homepage: http://github.com/grosser/scoped_cache_keys
|
41
|
-
licenses:
|
30
|
+
licenses:
|
42
31
|
- MIT
|
32
|
+
metadata: {}
|
43
33
|
post_install_message:
|
44
34
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
35
|
+
require_paths:
|
47
36
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
|
50
|
-
requirements:
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
51
39
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
version: "0"
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
60
44
|
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
version: "0"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
66
47
|
requirements: []
|
67
|
-
|
68
|
-
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.24
|
48
|
+
rubygems_version: 3.1.6
|
70
49
|
signing_key:
|
71
|
-
specification_version:
|
72
|
-
summary: Add scoped_cache_key / expire_scoped_cache_key to your models for caching/sweeping
|
50
|
+
specification_version: 4
|
51
|
+
summary: Add scoped_cache_key / expire_scoped_cache_key to your models for caching/sweeping
|
52
|
+
of model-related caches + touch_if_necessary
|
73
53
|
test_files: []
|
74
|
-
|