railhead_cacheify 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/railhead_cacheify.rb +3 -2
- data/railhead_cacheify.gemspec +2 -2
- metadata +4 -4
data/lib/railhead_cacheify.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support'
|
2
2
|
|
3
|
+
|
3
4
|
module RailheadCacheify
|
4
5
|
|
5
6
|
def self.cache_store=(options)
|
@@ -14,11 +15,11 @@ module RailheadCacheify
|
|
14
15
|
base.extend ClassMethods
|
15
16
|
base.class_eval do
|
16
17
|
def read_cache(key, options = {}, &block)
|
17
|
-
|
18
|
+
new_record? ? yield : RailheadCacheify.cache.fetch("#{key}:#{self.class.name}:#{self.id}", options) { yield }
|
18
19
|
end
|
19
20
|
|
20
21
|
def delete_cache(key)
|
21
|
-
RailheadCacheify.cache.delete("#{key}:#{self.class.name}:#{self.id}")
|
22
|
+
RailheadCacheify.cache.delete("#{key}:#{self.class.name}:#{self.id}") unless new_record?
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
data/railhead_cacheify.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "railhead_cacheify"
|
3
|
-
s.version = "0.0.
|
4
|
-
s.date = "2010-
|
3
|
+
s.version = "0.0.4"
|
4
|
+
s.date = "2010-12-07"
|
5
5
|
s.summary = "RailheadCacheify is a Ruby on Rails plugin that helps caching model functions."
|
6
6
|
s.email = "nagybence@tipogral.hu"
|
7
7
|
s.homepage = "http://github.com/nagybence/railhead_cacheify"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: railhead_cacheify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bence Nagy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-07 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|