redvex-ar_cache 0.1.1 → 0.1.2
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 +24 -20
- data/Rakefile +1 -1
- data/ar_cache.gemspec +2 -2
- data/lib/ar_cache.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -16,48 +16,52 @@ If you use this software, please make a donation[https://www.paypal.com/cgi-bin/
|
|
16
16
|
=Usage
|
17
17
|
|
18
18
|
==Installation
|
19
|
-
|
20
|
-
|
19
|
+
gem sources -a http://gems.github.com
|
20
|
+
gem install redvex-ar_cache
|
21
21
|
|
22
22
|
Add in your config/enviroment.rb
|
23
23
|
|
24
|
-
config.gem "redvex-ar_cache", :lib => 'ar_cache', :source => 'http://gems.github.com'
|
24
|
+
config.gem "redvex-ar_cache", :lib => 'ar_cache', :source => 'http://gems.github.com'
|
25
25
|
|
26
26
|
==Use ActiveRecord Cache
|
27
27
|
|
28
28
|
If you want to perform a standard call using cache u can try
|
29
29
|
|
30
|
-
|
30
|
+
Object.cache_find(id, params)
|
31
31
|
|
32
32
|
EX.
|
33
|
-
|
33
|
+
Object.cache_find(10)
|
34
|
+
|
34
35
|
or
|
35
|
-
|
36
|
+
|
37
|
+
Object.cache_find(:all, :conditions => ['field>?',5])
|
36
38
|
|
37
39
|
If you want to use an active record shortcuts you can:
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
Object.cache_find_first(params)
|
42
|
+
Object.cache_find_last(params)
|
43
|
+
Object.cache_find_all(params)
|
42
44
|
|
43
45
|
EX.
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
Object.cache_find_first
|
48
|
+
Object.cache_find_last
|
49
|
+
Object.cache_find_all(:conditions => ['filed>?', 5])
|
48
50
|
|
49
51
|
==Cache reset
|
50
52
|
If you want to reset cache after predetermined amount of time you can specify time in database.yml config file through cache_expire directive:
|
51
53
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
cache_expire: 30.seconds
|
55
|
+
cache_expire: 2.hours
|
56
|
+
cache_expire: 1.day
|
57
|
+
cache_expire: 1.month
|
56
58
|
|
57
59
|
If you want to force the expire the cache manually you can call the method
|
58
60
|
|
59
|
-
|
61
|
+
cache_reset(id, params=nil)
|
62
|
+
|
60
63
|
or shortcuts
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
|
65
|
+
cache_reset_first(params=nil)
|
66
|
+
cache_reset_last(params=nil)
|
67
|
+
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.2') 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
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ar_cache}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Gianni Mazza"]
|
9
|
-
s.date = %q{2009-08-
|
9
|
+
s.date = %q{2009-08-13}
|
10
10
|
s.description = %q{Performe ActiveRecord cache in File System for heavy and repetitive query.}
|
11
11
|
s.email = %q{redvex@me.com}
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/ar_cache.rb", "README.rdoc"]
|
data/lib/ar_cache.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redvex-ar_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gianni Mazza
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-13 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|