simple_cache_rs 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_cache.rb +6 -1
- data/lib/simple_cache/pg_store.rb +35 -0
- data/test/coverage/assets/0.5.3/app.js +88 -0
- data/test/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/test/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +363 -0
- data/test/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +44 -0
- data/test/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/test/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/test/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/test/coverage/assets/0.5.3/highlight.css +129 -0
- data/test/coverage/assets/0.5.3/highlight.pack.js +1 -0
- data/test/coverage/assets/0.5.3/jquery-1.6.2.min.js +18 -0
- data/test/coverage/assets/0.5.3/jquery.dataTables.min.js +152 -0
- data/test/coverage/assets/0.5.3/jquery.timeago.js +141 -0
- data/test/coverage/assets/0.5.3/jquery.url.js +174 -0
- data/test/coverage/assets/0.5.3/loading.gif +0 -0
- data/test/coverage/assets/0.5.3/magnify.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/test/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +295 -0
- data/test/coverage/assets/0.5.3/stylesheet.css +383 -0
- data/test/coverage/index.html +81 -0
- data/test/pg_store_test.rb +18 -0
- data/test/test_helper.rb +8 -4
- metadata +69 -21
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'test_helper'
|
2
|
+
|
3
|
+
class SimpleCache::PgStoreTest < Test::Unit::TestCase
|
4
|
+
include SimpleCache::TestCase
|
5
|
+
|
6
|
+
def simple_cache
|
7
|
+
@simple_cache ||= SimpleCache.new("pg://simple_cache:simple_cache@localhost/simple_cache_test").tap(&:clear)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_expiration
|
11
|
+
assert_equal("1", simple_cache.store("forever", "1"))
|
12
|
+
assert_equal("2", simple_cache.store("young", "2", 3))
|
13
|
+
Timecop.freeze(Time.now + 10) do
|
14
|
+
assert_equal("1", simple_cache.fetch("forever"))
|
15
|
+
assert_equal(nil, simple_cache.fetch("young"))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -28,13 +28,17 @@ module SimpleCache::TestCase
|
|
28
28
|
|
29
29
|
assert_equal("foo", simple_cache.store("bar", "foo"))
|
30
30
|
assert_equal("foo", simple_cache.fetch("bar"))
|
31
|
-
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_simple_cache_expiration
|
32
34
|
done = 0
|
33
|
-
assert_equal "baz", simple_cache.cached("
|
35
|
+
assert_equal "baz", simple_cache.cached("key2") { done += 1; "baz" }
|
34
36
|
assert_equal 1, done
|
35
|
-
assert_equal "baz", simple_cache.cached("
|
37
|
+
assert_equal "baz", simple_cache.cached("key2") { done += 1; "baz" }
|
36
38
|
assert_equal 1, done
|
37
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_simple_cache_store_and_fetch
|
38
42
|
assert_equal(nil, simple_cache.store("bar", nil))
|
39
43
|
assert_equal(nil, simple_cache.fetch("bar"))
|
40
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_cache_rs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: expectation
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70272344276440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *70272344276440
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: redis
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70272344248420 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *70272344248420
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: redis-namespace
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70272344243080 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,12 +43,18 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
46
|
+
version_requirements: *70272344243080
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: micro_sql
|
49
|
+
requirement: &70272344242040 !ruby/object:Gem::Requirement
|
57
50
|
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70272344242040
|
62
58
|
description: A sensibly fast, yet simplistic sqlite- or redis-based cache.
|
63
59
|
email: eno@radiospiel.org
|
64
60
|
executables: []
|
@@ -66,11 +62,63 @@ extensions: []
|
|
66
62
|
extra_rdoc_files: []
|
67
63
|
files:
|
68
64
|
- lib/simple_cache/marshal.rb
|
65
|
+
- lib/simple_cache/pg_store.rb
|
69
66
|
- lib/simple_cache/redis_store.rb
|
70
67
|
- lib/simple_cache/sqlite_store.rb
|
71
68
|
- lib/simple_cache.rb
|
72
69
|
- README.rdoc
|
70
|
+
- test/coverage/assets/0.5.3/app.js
|
71
|
+
- test/coverage/assets/0.5.3/fancybox/blank.gif
|
72
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_close.png
|
73
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_loading.png
|
74
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_nav_left.png
|
75
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_nav_right.png
|
76
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png
|
77
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png
|
78
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png
|
79
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png
|
80
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png
|
81
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png
|
82
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png
|
83
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png
|
84
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_title_left.png
|
85
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_title_main.png
|
86
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_title_over.png
|
87
|
+
- test/coverage/assets/0.5.3/fancybox/fancy_title_right.png
|
88
|
+
- test/coverage/assets/0.5.3/fancybox/fancybox-x.png
|
89
|
+
- test/coverage/assets/0.5.3/fancybox/fancybox-y.png
|
90
|
+
- test/coverage/assets/0.5.3/fancybox/fancybox.png
|
91
|
+
- test/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css
|
92
|
+
- test/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js
|
93
|
+
- test/coverage/assets/0.5.3/favicon_green.png
|
94
|
+
- test/coverage/assets/0.5.3/favicon_red.png
|
95
|
+
- test/coverage/assets/0.5.3/favicon_yellow.png
|
96
|
+
- test/coverage/assets/0.5.3/highlight.css
|
97
|
+
- test/coverage/assets/0.5.3/highlight.pack.js
|
98
|
+
- test/coverage/assets/0.5.3/jquery-1.6.2.min.js
|
99
|
+
- test/coverage/assets/0.5.3/jquery.dataTables.min.js
|
100
|
+
- test/coverage/assets/0.5.3/jquery.timeago.js
|
101
|
+
- test/coverage/assets/0.5.3/jquery.url.js
|
102
|
+
- test/coverage/assets/0.5.3/loading.gif
|
103
|
+
- test/coverage/assets/0.5.3/magnify.png
|
104
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
105
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
106
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
107
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
108
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
109
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
110
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
111
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
112
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png
|
113
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png
|
114
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png
|
115
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png
|
116
|
+
- test/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png
|
117
|
+
- test/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css
|
118
|
+
- test/coverage/assets/0.5.3/stylesheet.css
|
119
|
+
- test/coverage/index.html
|
73
120
|
- test/memoize_test.rb
|
121
|
+
- test/pg_store_test.rb
|
74
122
|
- test/redis_store_test.rb
|
75
123
|
- test/simple_cache_test.rb
|
76
124
|
- test/sqlite_store_test.rb
|
@@ -89,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
137
|
version: '0'
|
90
138
|
segments:
|
91
139
|
- 0
|
92
|
-
hash:
|
140
|
+
hash: 3223836389259576757
|
93
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
142
|
none: false
|
95
143
|
requirements:
|
@@ -98,10 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
146
|
version: '0'
|
99
147
|
segments:
|
100
148
|
- 0
|
101
|
-
hash:
|
149
|
+
hash: 3223836389259576757
|
102
150
|
requirements: []
|
103
151
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.8.
|
152
|
+
rubygems_version: 1.8.10
|
105
153
|
signing_key:
|
106
154
|
specification_version: 3
|
107
155
|
summary: A sensibly fast, yet simplistic sqlite- or redis-based cache.
|