collection_cache_key 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 236fb361641a74662f0f4988f9e86383210f0932
4
+ data.tar.gz: a72e11b5bd9bf12585ce3d790f0c2bf05c7ef0f2
5
+ SHA512:
6
+ metadata.gz: fa0dd32c1699c6d36e70091d451de5ceb15d8f153ec0fc1d60e9071838ebde7d88dcef0a400a537a686ab6342a7e2faf1ab97a1671ecf03c2c8c59eccc5458ac
7
+ data.tar.gz: e59e0df472d1f7818d2b76edc4f253406d545be05c32489ea584d2c9ab412c82d6b155b6dad7bed149d46d1c37a4b373eb09fa30f348a4dafc453d6e82eb3d3f
@@ -0,0 +1,10 @@
1
+ *.gem
2
+ .bundle
3
+ .config
4
+ Gemfile.lock
5
+ InstalledFiles
6
+ coverage
7
+ spec/reports
8
+ test/tmp
9
+ test/version_tmp
10
+ tmp
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Alessandro Lepore
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,32 @@
1
+ # CollectionCacheKey
2
+
3
+ Adds a basic `cache_key` method to `ActiveRecord::Base` subclasses for easy collection fragment caching.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+ ```ruby
9
+ gem 'collection_cache_key'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ ## Usage
17
+
18
+ ```erb
19
+ <% cache MyModel do %>
20
+ <% MyModel.all.each do |m| %>
21
+ ...
22
+ <% end %>
23
+ <% end %>
24
+ ```
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it ( https://github.com/freego/collection_cache_key/fork )
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'collection_cache_key'
7
+ spec.version = '1.0.0'
8
+ spec.authors = ['Alessandro Lepore']
9
+ spec.email = ['a.lepore@freegoweb.it']
10
+ spec.summary = 'Adds a basic cache_key method to ActiveRecord::Base subclasses'
11
+ spec.description = 'Adds a basic cache_key method to ActiveRecord::Base subclasses for easy collection fragment caching.'
12
+ spec.homepage = 'https://github.com/freego/collection_cache_key'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = []
17
+ spec.test_files = []
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.required_ruby_version = '>= 1.9.3'
21
+
22
+ spec.add_development_dependency 'bundler', '~> 1.5'
23
+ spec.add_development_dependency 'rake'
24
+
25
+ spec.add_runtime_dependency 'activerecord'
26
+ end
@@ -0,0 +1,7 @@
1
+ module CollectionCacheKey
2
+ ActiveRecord::Base.class_eval do
3
+ def self.cache_key
4
+ "#{name.tableize}/all-#{count}-#{maximum(:updated_at).try(:to_i)}"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: collection_cache_key
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alessandro Lepore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Adds a basic cache_key method to ActiveRecord::Base subclasses for easy
56
+ collection fragment caching.
57
+ email:
58
+ - a.lepore@freegoweb.it
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - collection_cache_key.gemspec
69
+ - lib/collection_cache_key.rb
70
+ homepage: https://github.com/freego/collection_cache_key
71
+ licenses:
72
+ - MIT
73
+ metadata: {}
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.9.3
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 2.2.2
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Adds a basic cache_key method to ActiveRecord::Base subclasses
94
+ test_files: []