cache_key_for 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Appraisals +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +93 -0
- data/LICENSE.txt +21 -0
- data/README.md +75 -0
- data/Rakefile +18 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cache_key_for.gemspec +52 -0
- data/gemfiles/rails_4.1.0.gemfile +7 -0
- data/gemfiles/rails_4.2.0.gemfile +7 -0
- data/lib/cache_key_for/cache_key_for_helper.rb +46 -0
- data/lib/cache_key_for/cache_key_for_view_helper.rb +22 -0
- data/lib/cache_key_for/railtie.rb +13 -0
- data/lib/cache_key_for/version.rb +3 -0
- data/lib/cache_key_for.rb +5 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 65f947c28df0505768d59510c841a2b2cc1cbdad
|
4
|
+
data.tar.gz: 439a17b86ab90a3a348b7fd24888db67e2db7621
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca839ffbe1cf763cc448a76d13171f409f363f5e218db2f00f949bebd6a507bdda4dfbd3bf22e53d93dba133b040fc81d8764f78c86b1fafd78264f0544e5135
|
7
|
+
data.tar.gz: a40ce417551f596834f39e7b2e7fc86242af434a3c7e4a715137174a8079c6e69aecb97d56a7722c4c960deef83345a7a7afe39b148eaefaf3a565c00457e220
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Appraisals
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at mkalita@artegence.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cache_key_for (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionpack (4.2.0)
|
10
|
+
actionview (= 4.2.0)
|
11
|
+
activesupport (= 4.2.0)
|
12
|
+
rack (~> 1.6.0)
|
13
|
+
rack-test (~> 0.6.2)
|
14
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
15
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
16
|
+
actionview (4.2.0)
|
17
|
+
activesupport (= 4.2.0)
|
18
|
+
builder (~> 3.1)
|
19
|
+
erubis (~> 2.7.0)
|
20
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
21
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
22
|
+
activesupport (4.2.0)
|
23
|
+
i18n (~> 0.7)
|
24
|
+
json (~> 1.7, >= 1.7.7)
|
25
|
+
minitest (~> 5.1)
|
26
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
27
|
+
tzinfo (~> 1.1)
|
28
|
+
appraisal (1.0.2)
|
29
|
+
bundler
|
30
|
+
rake
|
31
|
+
thor (>= 0.14.0)
|
32
|
+
builder (3.2.2)
|
33
|
+
diff-lcs (1.2.5)
|
34
|
+
erubis (2.7.0)
|
35
|
+
i18n (0.7.0)
|
36
|
+
json (1.8.2)
|
37
|
+
loofah (2.0.1)
|
38
|
+
nokogiri (>= 1.5.9)
|
39
|
+
mini_portile (0.6.2)
|
40
|
+
minitest (5.5.1)
|
41
|
+
nokogiri (1.6.6.2)
|
42
|
+
mini_portile (~> 0.6.0)
|
43
|
+
rack (1.6.0)
|
44
|
+
rack-test (0.6.3)
|
45
|
+
rack (>= 1.0)
|
46
|
+
rails-deprecated_sanitizer (1.0.3)
|
47
|
+
activesupport (>= 4.2.0.alpha)
|
48
|
+
rails-dom-testing (1.0.5)
|
49
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
50
|
+
nokogiri (~> 1.6.0)
|
51
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
52
|
+
rails-html-sanitizer (1.0.1)
|
53
|
+
loofah (~> 2.0)
|
54
|
+
railties (4.2.0)
|
55
|
+
actionpack (= 4.2.0)
|
56
|
+
activesupport (= 4.2.0)
|
57
|
+
rake (>= 0.8.7)
|
58
|
+
thor (>= 0.18.1, < 2.0)
|
59
|
+
rake (10.4.2)
|
60
|
+
rspec-core (3.2.1)
|
61
|
+
rspec-support (~> 3.2.0)
|
62
|
+
rspec-expectations (3.2.0)
|
63
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
64
|
+
rspec-support (~> 3.2.0)
|
65
|
+
rspec-mocks (3.2.1)
|
66
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
67
|
+
rspec-support (~> 3.2.0)
|
68
|
+
rspec-rails (3.2.1)
|
69
|
+
actionpack (>= 3.0, < 4.3)
|
70
|
+
activesupport (>= 3.0, < 4.3)
|
71
|
+
railties (>= 3.0, < 4.3)
|
72
|
+
rspec-core (~> 3.2.0)
|
73
|
+
rspec-expectations (~> 3.2.0)
|
74
|
+
rspec-mocks (~> 3.2.0)
|
75
|
+
rspec-support (~> 3.2.0)
|
76
|
+
rspec-support (3.2.2)
|
77
|
+
sqlite3 (1.3.10)
|
78
|
+
thor (0.19.1)
|
79
|
+
thread_safe (0.3.4)
|
80
|
+
tzinfo (1.2.2)
|
81
|
+
thread_safe (~> 0.1)
|
82
|
+
|
83
|
+
PLATFORMS
|
84
|
+
ruby
|
85
|
+
|
86
|
+
DEPENDENCIES
|
87
|
+
appraisal (~> 1.0)
|
88
|
+
cache_key_for!
|
89
|
+
rspec-rails (~> 3.1)
|
90
|
+
sqlite3 (~> 1.3)
|
91
|
+
|
92
|
+
BUNDLED WITH
|
93
|
+
1.11.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Efigence
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# CacheKeyFor [![Build Status](https://travis-ci.org/efigence/cache_key_for.svg?branch=master)](https://travis-ci.org/efigence/cache_key_for)
|
2
|
+
Comprehensive cache key generator (complements Rails `cache` helper)
|
3
|
+
|
4
|
+
How to design a perfect cache key? This project's goal is to provide the bulletproof solution for most use cases.
|
5
|
+
|
6
|
+
## Install
|
7
|
+
|
8
|
+
cache_key_for is a Railtie. We support the versions of Ruby and Rails listed in [.travis.yml](.travis.yml).
|
9
|
+
|
10
|
+
It should be run as a gem and included in your `Gemfile`:
|
11
|
+
|
12
|
+
gem "cache_key_for"
|
13
|
+
|
14
|
+
### \#cache_key_for
|
15
|
+
|
16
|
+
Features:
|
17
|
+
* locale
|
18
|
+
* pagination
|
19
|
+
* scoped collections
|
20
|
+
* deletion from and addition to collections sorted in ascending order (via embedded `count` in the key)
|
21
|
+
* accepts `cache_owner_cache_key` for personalized cache, eg. current_company.cache_key, current_user.cache_key etc.
|
22
|
+
* all params (including other than GET's query params) with proper non-utf8 data handling for key generation
|
23
|
+
* optional suffix for:
|
24
|
+
* expiry tags (unlike :expires_in cache option, this offers full :file_store storage compatibility)
|
25
|
+
* any edge cases
|
26
|
+
* file differentiation and file changes are handled separately by Rails' `cache` helper (md5 is added at the end of cache path)
|
27
|
+
* one key instead of many, but also unobtrusive (example in haml):
|
28
|
+
|
29
|
+
```haml
|
30
|
+
- cache [cache_key_for(@articles, 'articles'), @some_active_model_object, 'box-type-view'] do
|
31
|
+
(...)
|
32
|
+
```
|
33
|
+
* core concept of Russian Doll Caching is touching: `belongs_to :some_model, touch: true`, but if you do not use `touch`, you can still cache safely like this (example in haml):
|
34
|
+
|
35
|
+
```haml
|
36
|
+
- cache [cache_key_for(@articles, 'articles'), @some_model_instance] do
|
37
|
+
(...)
|
38
|
+
```
|
39
|
+
|
40
|
+
Example (haml):
|
41
|
+
|
42
|
+
```haml
|
43
|
+
- cache cache_key_for(@service.datacenters, 'datacenters', current_company.cache_key, Time.now.utc.to_date.to_s) do
|
44
|
+
(...)
|
45
|
+
```
|
46
|
+
|
47
|
+
Rails will generate cache at:
|
48
|
+
|
49
|
+
```
|
50
|
+
app_name:views/en/datacenters/5bd92bd352e7726d02175752913014711f5d412e/companies/1-20150619101645935901000/2015-06-26/7a6f89a738006a69c1d1e0214e147bab
|
51
|
+
```
|
52
|
+
|
53
|
+
### \#cache_key_for_view
|
54
|
+
|
55
|
+
Features:
|
56
|
+
* all features of `cache_key_for` method
|
57
|
+
* better debugging (accepts view/partial file path for visible part of cache key)
|
58
|
+
|
59
|
+
Example (haml):
|
60
|
+
|
61
|
+
```haml
|
62
|
+
- cache cache_key_for_view(__FILE__, @service.datacenters, 'datacenters', current_company.cache_key, Time.now.utc.to_date.to_s) do
|
63
|
+
```
|
64
|
+
|
65
|
+
Rails will generate cache at:
|
66
|
+
|
67
|
+
```
|
68
|
+
app_name:views/en/datacenters/5bd92bd352e7726d02175752913014711f5d412e/companies/1-20150619101645935901000/2015-06-
|
69
|
+
26/app/views/services/datacenters.html.haml/4324f99340fd2b2bc7e26b8e9b79d8f5
|
70
|
+
```
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
./bin/setup
|
75
|
+
bundle exec rake
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'appraisal'
|
4
|
+
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
|
+
|
8
|
+
task :default do |t|
|
9
|
+
if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
|
10
|
+
exec 'rake spec'
|
11
|
+
else
|
12
|
+
Rake::Task['appraise'].execute
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
task :appraise => ['appraisal:install'] do |t|
|
17
|
+
exec 'rake appraisal'
|
18
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "flutie"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'cache_key_for/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'cache_key_for'
|
7
|
+
s.version = CacheKeyFor::VERSION.dup
|
8
|
+
s.authors = ['Marcin Kalita']
|
9
|
+
s.email = ['mkalita@efigence.com']
|
10
|
+
|
11
|
+
s.summary = %q{Comprehensive cache key generator (complements Rails `cache` helper)}
|
12
|
+
s.description = %q{How to design a perfect cache key? This project's goal is to provide a bulletproof solution for most use cases.}
|
13
|
+
s.homepage = 'http://github.com/efigence/cache_key_for'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
if s.respond_to?(:metadata)
|
19
|
+
s.metadata['allowed_push_host'] = "https://rubygems.org"
|
20
|
+
else
|
21
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
end
|
23
|
+
|
24
|
+
#s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
s.files = [ ".gitignore",
|
26
|
+
".rspec",
|
27
|
+
".travis.yml",
|
28
|
+
"Appraisals",
|
29
|
+
"CODE_OF_CONDUCT.md",
|
30
|
+
"Gemfile",
|
31
|
+
"Gemfile.lock",
|
32
|
+
"LICENSE.txt",
|
33
|
+
"README.md",
|
34
|
+
"Rakefile",
|
35
|
+
"bin/console",
|
36
|
+
"bin/setup",
|
37
|
+
"cache_key_for.gemspec",
|
38
|
+
"gemfiles/rails_4.1.0.gemfile",
|
39
|
+
"gemfiles/rails_4.2.0.gemfile",
|
40
|
+
"lib/cache_key_for.rb",
|
41
|
+
"lib/cache_key_for/cache_key_for_helper.rb",
|
42
|
+
"lib/cache_key_for/cache_key_for_view_helper.rb",
|
43
|
+
"lib/cache_key_for/railtie.rb",
|
44
|
+
"lib/cache_key_for/version.rb" ]
|
45
|
+
s.bindir = "exe"
|
46
|
+
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
47
|
+
s.require_paths = ['lib']
|
48
|
+
|
49
|
+
s.add_development_dependency('appraisal', '~> 1.0')
|
50
|
+
s.add_development_dependency('sqlite3', '~> 1.3')
|
51
|
+
s.add_development_dependency('rspec-rails', '~> 3.1')
|
52
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Features:
|
2
|
+
# * locale
|
3
|
+
# * pagination
|
4
|
+
# * scoped collections
|
5
|
+
# * deletion from and addition to collections sorted in ascending order (via embedded `count` in the key)
|
6
|
+
# * accepts `cache_owner_cache_key` for personalized cache, eg. current_company.cache_key, current_user.cache_key etc.
|
7
|
+
# * all params (including other than GET's query params) with proper non-utf8 data handling for key generation
|
8
|
+
# * optional suffix for:
|
9
|
+
# * expiry tags (unlike :expires_in cache option, this offers full :file_store storage compatibility)
|
10
|
+
# * any edge cases
|
11
|
+
# * file differentiation and file changes are handled separately by Rails' `cache` helper (md5 is added at the end of cache path)
|
12
|
+
# * one key instead of many, but also unobtrusive (example in haml):
|
13
|
+
|
14
|
+
# ```haml
|
15
|
+
# - cache [cache_key_for(@articles, 'articles'), @some_active_model_object, 'box-type-view'] do
|
16
|
+
# (...)
|
17
|
+
# ```
|
18
|
+
# * core concept of Russian Doll Caching is touching: `belongs_to :some_model, touch: true`, but if you do not use `touch`, you can still cache safely like this (example in haml):
|
19
|
+
|
20
|
+
# ```haml
|
21
|
+
# - cache [cache_key_for(@articles, 'articles'), @some_model_instance] do
|
22
|
+
# (...)
|
23
|
+
# ```
|
24
|
+
|
25
|
+
# Example (haml):
|
26
|
+
|
27
|
+
# ```haml
|
28
|
+
# - cache cache_key_for(@service.datacenters, 'datacenters', current_company.cache_key, Time.now.utc.to_date.to_s) do
|
29
|
+
# (...)
|
30
|
+
# ```
|
31
|
+
|
32
|
+
# Rails will generate cache at:
|
33
|
+
|
34
|
+
# ```
|
35
|
+
# app_name:views/en/datacenters/5bd92bd352e7726d02175752913014711f5d412e/companies/1-20150619101645935901000/2015-06-26/7a6f89a738006a69c1d1e0214e147bab
|
36
|
+
# ```
|
37
|
+
module CacheKeyForHelper
|
38
|
+
def cache_key_for(scoped_collection, collection_prefix, cache_owner_cache_key = '', suffix = '')
|
39
|
+
max_updated_at = scoped_collection.to_a.map{|i| i.updated_at.to_i }.max.to_i
|
40
|
+
count = scoped_collection.count
|
41
|
+
ids_string = scoped_collection.to_a.map(&:id).join('-')
|
42
|
+
request_params = request.params ? request.params.map{|k, v| [k.dup.force_encoding("UTF-8"), v.dup.force_encoding("UTF-8")] } : nil
|
43
|
+
digest = Digest::SHA1.hexdigest("#{ids_string}-#{max_updated_at}-#{count}-#{request.path}-#{request_params}")
|
44
|
+
"#{I18n.locale}/#{collection_prefix}/#{digest}/#{cache_owner_cache_key}/#{suffix}"
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Features:
|
2
|
+
# * all features of `cache_key_for` method
|
3
|
+
# * better debugging (accepts view/partial file path for visible part of cache key)
|
4
|
+
|
5
|
+
# Example (haml):
|
6
|
+
|
7
|
+
# ```haml
|
8
|
+
# - cache cache_key_for_view(__FILE__, @service.datacenters, 'datacenters', current_company.cache_key, Time.now.utc.to_date.to_s) do
|
9
|
+
# ```
|
10
|
+
|
11
|
+
# Rails will generate cache at:
|
12
|
+
|
13
|
+
# ```
|
14
|
+
# app_name:views/en/datacenters/5bd92bd352e7726d02175752913014711f5d412e/companies/1-20150619101645935901000/2015-06-
|
15
|
+
# 26/app/views/services/datacenters.html.haml/4324f99340fd2b2bc7e26b8e9b79d8f5
|
16
|
+
# ```
|
17
|
+
module CacheKeyForViewHelper
|
18
|
+
include CacheKeyForHelper
|
19
|
+
def cache_key_for_view(file, scoped_collection, collection_prefix, cache_owner_cache_key = '', suffix = '')
|
20
|
+
"#{cache_key_for(scoped_collection, collection_prefix, cache_owner_cache_key, suffix)}#{file.gsub(Rails.root.to_s, '')}"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'cache_key_for/cache_key_for_helper'
|
2
|
+
require 'cache_key_for/cache_key_for_view_helper'
|
3
|
+
|
4
|
+
module CacheKeyFor
|
5
|
+
class Railtie < Rails::Railtie
|
6
|
+
initializer 'cache_key_for.helper' do |app|
|
7
|
+
ActionView::Base.send :include, CacheKeyForHelper
|
8
|
+
end
|
9
|
+
initializer 'cache_key_for_view.helper' do |app|
|
10
|
+
ActionView::Base.send :include, CacheKeyForViewHelper
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cache_key_for
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcin Kalita
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: appraisal
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.1'
|
55
|
+
description: How to design a perfect cache key? This project's goal is to provide
|
56
|
+
a bulletproof solution for most use cases.
|
57
|
+
email:
|
58
|
+
- mkalita@efigence.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Appraisals
|
67
|
+
- CODE_OF_CONDUCT.md
|
68
|
+
- Gemfile
|
69
|
+
- Gemfile.lock
|
70
|
+
- LICENSE.txt
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
73
|
+
- bin/console
|
74
|
+
- bin/setup
|
75
|
+
- cache_key_for.gemspec
|
76
|
+
- gemfiles/rails_4.1.0.gemfile
|
77
|
+
- gemfiles/rails_4.2.0.gemfile
|
78
|
+
- lib/cache_key_for.rb
|
79
|
+
- lib/cache_key_for/cache_key_for_helper.rb
|
80
|
+
- lib/cache_key_for/cache_key_for_view_helper.rb
|
81
|
+
- lib/cache_key_for/railtie.rb
|
82
|
+
- lib/cache_key_for/version.rb
|
83
|
+
homepage: http://github.com/efigence/cache_key_for
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata:
|
87
|
+
allowed_push_host: https://rubygems.org
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.5.1
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Comprehensive cache key generator (complements Rails `cache` helper)
|
108
|
+
test_files: []
|