h2ocube_rails_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.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/h2ocube_rails_cache.gemspec +1 -1
- data/lib/active_support/cache/h2ocube_rails_cache.rb +9 -0
- data/test/cache_test.rb +9 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6310c11ac4f3f8f51739aa0093ec9ecddecda9a4
|
4
|
+
data.tar.gz: 2aef6c3682d61a6817ced4fd54ae9fd95da3609f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e96f45ba648b840dbe501edfe48fc6e37a9e0b64c9129501f5e3b739831fcb059b16d11ee3c1693a8e4c60e8bb547fe159248028679007933f5e585199ae418b
|
7
|
+
data.tar.gz: 859d678430d4e2151dabfefb8c57df1c40105c3af1df27d37e833a499ee22ca3d6a194321e8129965b946c5a57efc1ecb1b9de57f62382334a83fab676da0325
|
data/README.md
CHANGED
data/h2ocube_rails_cache.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'h2ocube_rails_cache'
|
7
|
-
gem.version = '0.1.
|
7
|
+
gem.version = '0.1.2'
|
8
8
|
gem.authors = ['Ben']
|
9
9
|
gem.email = ['ben@h2ocube.com']
|
10
10
|
gem.description = 'Just an redis cache.'
|
@@ -124,6 +124,15 @@ module ActiveSupport
|
|
124
124
|
@data.info
|
125
125
|
end
|
126
126
|
|
127
|
+
def expire(key, expires_in)
|
128
|
+
options.reverse_merge! config
|
129
|
+
key = normalize_key key, options
|
130
|
+
|
131
|
+
instrument :expire, key, expires_in: expires_in.to_i do
|
132
|
+
@data.expire key, expires_in.to_i
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
127
136
|
def increment(key, amount = 1, options = {})
|
128
137
|
options.reverse_merge! config
|
129
138
|
key = normalize_key key, options
|
data/test/cache_test.rb
CHANGED
@@ -32,7 +32,7 @@ describe 'h2ocube_rails_cache' do
|
|
32
32
|
Rails.cache.read('a').must_be_nil
|
33
33
|
end
|
34
34
|
|
35
|
-
it 'expire' do
|
35
|
+
it '#write expire' do
|
36
36
|
Rails.cache.delete 'expire'
|
37
37
|
Rails.cache.write 'expire', true, expires_in: 1.second
|
38
38
|
Rails.cache.exist?('expire').must_be_same_as true
|
@@ -40,6 +40,14 @@ describe 'h2ocube_rails_cache' do
|
|
40
40
|
Rails.cache.exist?('expire').must_be_same_as false
|
41
41
|
end
|
42
42
|
|
43
|
+
it '#expire' do
|
44
|
+
Rails.cache.write 'expire', true
|
45
|
+
Rails.cache.expire 'expire', 1.second
|
46
|
+
Rails.cache.exist?('expire').must_be_same_as true
|
47
|
+
sleep 2
|
48
|
+
Rails.cache.exist?('expire').must_be_same_as false
|
49
|
+
end
|
50
|
+
|
43
51
|
it 'key class' do
|
44
52
|
Rails.cache.write ['a', 0], 'a0'
|
45
53
|
Rails.cache.keys[0].must_equal "#{Rails.cache.config[:namespace]}:a/0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: h2ocube_rails_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
|
- Ben
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|