redvex-ar_cache 0.1.0 → 0.1.1
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/README.rdoc +9 -5
- data/Rakefile +1 -1
- data/ar_cache.gemspec +1 -1
- data/lib/ar_cache.rb +5 -5
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -17,7 +17,11 @@ If you use this software, please make a donation[https://www.paypal.com/cgi-bin/
|
|
17
17
|
|
18
18
|
==Installation
|
19
19
|
* gem sources -a http://gems.github.com
|
20
|
-
* gem install ar_cache
|
20
|
+
* gem install redvex-ar_cache
|
21
|
+
|
22
|
+
Add in your config/enviroment.rb
|
23
|
+
|
24
|
+
config.gem "redvex-ar_cache", :lib => 'ar_cache', :source => 'http://gems.github.com'
|
21
25
|
|
22
26
|
==Use ActiveRecord Cache
|
23
27
|
|
@@ -52,8 +56,8 @@ If you want to reset cache after predetermined amount of time you can specify ti
|
|
52
56
|
|
53
57
|
If you want to force the expire the cache manually you can call the method
|
54
58
|
|
55
|
-
* cache_reset
|
59
|
+
* cache_reset(id, params=nil)
|
56
60
|
or shortcuts
|
57
|
-
* cache_reset_first
|
58
|
-
* cache_reset_last
|
59
|
-
* cache_reset_all
|
61
|
+
* cache_reset_first(params=nil)
|
62
|
+
* cache_reset_last(params=nil)
|
63
|
+
* cache_reset_all(params=nil)
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('ar_cache', '0.1.
|
5
|
+
Echoe.new('ar_cache', '0.1.1') do |p|
|
6
6
|
p.description = "Performe ActiveRecord cache in File System for heavy and repetitive query."
|
7
7
|
p.url = "http://github.com/redvex/ar_cache"
|
8
8
|
p.author = "Gianni Mazza"
|
data/ar_cache.gemspec
CHANGED
data/lib/ar_cache.rb
CHANGED
@@ -32,7 +32,7 @@ module ArCache
|
|
32
32
|
|
33
33
|
filename = calculate_file_name(id, params)
|
34
34
|
if cache_reset?(filename)
|
35
|
-
cache_reset
|
35
|
+
cache_reset(id, params)
|
36
36
|
end
|
37
37
|
|
38
38
|
if File.exist?(filename)
|
@@ -70,19 +70,19 @@ module ArCache
|
|
70
70
|
return cache_find(:all, params)
|
71
71
|
end
|
72
72
|
|
73
|
-
def cache_reset_first
|
73
|
+
def cache_reset_first(params=nil)
|
74
74
|
return cache_reset(:first, params)
|
75
75
|
end
|
76
76
|
|
77
|
-
def cache_reset_last
|
77
|
+
def cache_reset_last(params=nil)
|
78
78
|
return cache_reset(:last, params)
|
79
79
|
end
|
80
80
|
|
81
|
-
def cache_reset_all
|
81
|
+
def cache_reset_all(params=nil)
|
82
82
|
return cache_reset(:all, params)
|
83
83
|
end
|
84
84
|
|
85
|
-
def cache_reset
|
85
|
+
def cache_reset(id, params=nil)
|
86
86
|
filename = calculate_file_name(id, params)
|
87
87
|
File.delete(filename)
|
88
88
|
end
|