grosser-cachy 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.markdown +13 -2
- data/VERSION +1 -1
- data/cachy.gemspec +2 -2
- data/lib/cachy.rb +2 -1
- data/spec/cachy_spec.rb +10 -0
- metadata +4 -3
data/README.markdown
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
Caching library to simplify and organize caching.
|
2
2
|
|
3
|
+
- I18n (seperate caches by locale / expires all locales)
|
4
|
+
- Generation based (expire all caches of one type)
|
5
|
+
- Simultanouse caching (multiple processes trying to write same cache at once)
|
6
|
+
- Dependent caches (x caches result of cache z+y -> z changes -> x changes)
|
7
|
+
- Hashed keys (optional -> short/unreadable)
|
8
|
+
- Global cache_version (expire everything Cachy cached)
|
9
|
+
- ...
|
3
10
|
- works out of the box with Rails
|
4
11
|
- works with pure Memcache and [Moneta](http://github.com/wycats/moneta/tree/master)(-> Tokyo Cabinet / CouchDB / S3 / Berkeley DB / DataMapper / Memory store)
|
5
12
|
|
@@ -41,8 +48,8 @@ Expire all all caches of one kind when e.g. codebase has been updated
|
|
41
48
|
Cachy.cache(:a_key, :witout_locale=>true){ 'German' } == 'English'
|
42
49
|
|
43
50
|
####Caching results of other caches
|
44
|
-
When inner cache is expired outer cache would normally still
|
45
|
-
|
51
|
+
When inner cache is expired outer cache would normally still shows old results.
|
52
|
+
--> expire outer cache when inner cache is expired.
|
46
53
|
|
47
54
|
a = Cachy.cache(:a, :expires_in=>1.day){ expensive() }
|
48
55
|
b = Cachy.cache(:b, :expires_in=>1.week){ expensive_2() }
|
@@ -66,6 +73,10 @@ Use a global `CACHE_VERSION=1` so that all caches can be expired when something
|
|
66
73
|
The cache server does not need to be restarted and session data(Rails) is saved.
|
67
74
|
|
68
75
|
|
76
|
+
#### Does not cache nil
|
77
|
+
If you want to cache a falsy result, use false
|
78
|
+
Cachy.cache(:x){ expensive || false }
|
79
|
+
|
69
80
|
###Cachy.expire / .expire_view
|
70
81
|
Expires all locales of a key
|
71
82
|
Cachy.locales = [:de, :en] # by default filled with I18n.available_locales
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/cachy.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cachy}
|
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 = ["Michael Grosser"]
|
9
|
-
s.date = %q{2009-09-
|
9
|
+
s.date = %q{2009-09-08}
|
10
10
|
s.email = %q{grosser.michael@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"README.markdown"
|
data/lib/cachy.rb
CHANGED
data/spec/cachy_spec.rb
CHANGED
@@ -34,6 +34,16 @@ describe Cachy do
|
|
34
34
|
Cachy.cache(:my_key){ 'X' }.should == "X"
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
it "can cache false" do
|
39
|
+
Cachy.cache(:x){ false }.should == false
|
40
|
+
Cachy.cache(:x){ true }.should == false
|
41
|
+
end
|
42
|
+
|
43
|
+
it "does not cache nil" do
|
44
|
+
Cachy.cache(:x){ nil }.should == nil
|
45
|
+
Cachy.cache(:x){ true }.should == true
|
46
|
+
end
|
37
47
|
end
|
38
48
|
|
39
49
|
describe :expire do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grosser-cachy
|
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
|
- Michael Grosser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- spec/test_cache.rb
|
38
38
|
has_rdoc: false
|
39
39
|
homepage: http://github.com/grosser/cachy
|
40
|
+
licenses:
|
40
41
|
post_install_message:
|
41
42
|
rdoc_options:
|
42
43
|
- --charset=UTF-8
|
@@ -57,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
58
|
requirements: []
|
58
59
|
|
59
60
|
rubyforge_project:
|
60
|
-
rubygems_version: 1.
|
61
|
+
rubygems_version: 1.3.5
|
61
62
|
signing_key:
|
62
63
|
specification_version: 3
|
63
64
|
summary: Caching library for projects that have many processes or many caches
|