opsb-ziggy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.markdown +8 -6
- data/RakeFile +15 -0
- data/VERSION.yml +4 -0
- data/lib/ziggy.rb +1 -1
- data/ziggy.gemspec +7 -3
- metadata +5 -1
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Oliver Searle-Barnes
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
ziggy
|
2
2
|
=====
|
3
3
|
|
4
|
-
Cache any method on any class using
|
4
|
+
Cache any method on any class using Rails.cache
|
5
5
|
|
6
6
|
Install
|
7
7
|
-------
|
8
8
|
|
9
|
-
$ gem sources -a http://gems.github.com (you only have to do this once)
|
10
|
-
$ sudo gem install opsb-ziggy
|
9
|
+
$ gem sources -a http://gems.github.com (you only have to do this once)
|
10
|
+
$ sudo gem install opsb-ziggy
|
11
11
|
|
12
12
|
Introduction
|
13
13
|
------------
|
14
14
|
|
15
|
+
ziggy will cache methods and then expire them. The results from method invocations are stored in and read from the Rails.cache using Rails.cache.write(key, value) and Rails.cache.read(key).
|
16
|
+
|
15
17
|
### Cache a method
|
16
18
|
|
17
19
|
class TwitterUser
|
@@ -46,6 +48,8 @@ Introduction
|
|
46
48
|
|
47
49
|
### expire_after
|
48
50
|
|
51
|
+
The default expire_after time is 2.5.minutes, to customise do
|
52
|
+
|
49
53
|
class TwitterUser
|
50
54
|
include Ziggy
|
51
55
|
cached :timeline, :expire_after => 1.5.minutes
|
@@ -60,7 +64,7 @@ Introduction
|
|
60
64
|
|
61
65
|
### Customise key
|
62
66
|
|
63
|
-
The method name and arguments are always used as the base of the cache key.
|
67
|
+
The method name and arguments are always used as the base of the cache key. You can customise the start of the cache key using a block.
|
64
68
|
|
65
69
|
class TwitterUser
|
66
70
|
include Ziggy
|
@@ -76,8 +80,6 @@ The method name and arguments are always used as the base of the cache key. Usin
|
|
76
80
|
|
77
81
|
### Different options for different methods
|
78
82
|
|
79
|
-
The method name and arguments are always used as the base of the cache key. You can customise the start of the cache key using a block.
|
80
|
-
|
81
83
|
class TwitterUser
|
82
84
|
include Ziggy
|
83
85
|
cached :timeline, :expire_after => 1.minutes { |twitterUser| twitterUser.screen_name }
|
data/RakeFile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
task :default => [:gemspec]
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'jeweler'
|
5
|
+
Jeweler::Tasks.new do |gemspec|
|
6
|
+
gemspec.name = "ziggy"
|
7
|
+
gemspec.summary = "Cache any method on any class"
|
8
|
+
gemspec.description = "ziggy can be used to cache any method on any class and allows custom keys and expiration times"
|
9
|
+
gemspec.email = "oliver@opsb.co.uk"
|
10
|
+
gemspec.homepage = "http://github.com/opsb/ziggy"
|
11
|
+
gemspec.authors = ["Oliver Searle-Barnes"]
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
15
|
+
end
|
data/VERSION.yml
ADDED
data/lib/ziggy.rb
CHANGED
data/ziggy.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ziggy}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Oliver Searle-Barnes"]
|
@@ -10,10 +10,14 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.description = %q{ziggy can be used to cache any method on any class and allows custom keys and expiration times}
|
11
11
|
s.email = %q{oliver@opsb.co.uk}
|
12
12
|
s.extra_rdoc_files = [
|
13
|
-
"
|
13
|
+
"LICENSE",
|
14
|
+
"README.markdown"
|
14
15
|
]
|
15
16
|
s.files = [
|
16
|
-
"
|
17
|
+
"LICENSE",
|
18
|
+
"README.markdown",
|
19
|
+
"RakeFile",
|
20
|
+
"VERSION.yml",
|
17
21
|
"lib/ziggy.rb",
|
18
22
|
"ziggy.gemspec"
|
19
23
|
]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opsb-ziggy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Searle-Barnes
|
@@ -20,9 +20,13 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
+
- LICENSE
|
23
24
|
- README.markdown
|
24
25
|
files:
|
26
|
+
- LICENSE
|
25
27
|
- README.markdown
|
28
|
+
- RakeFile
|
29
|
+
- VERSION.yml
|
26
30
|
- lib/ziggy.rb
|
27
31
|
- ziggy.gemspec
|
28
32
|
has_rdoc: true
|