readthis 0.6.0 → 0.6.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -2
- data/lib/readthis/cache.rb +2 -2
- data/lib/readthis/version.rb +1 -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: 526a587fdb24dce81997fc27843cea6e4f3ae5f0
|
4
|
+
data.tar.gz: 545038b4b9ccd67e896a67c2bae81d8644fed8dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2245689f28e842a9271c3a2c5f68c5ad680b8aebc308ab6a4ac41d292d70a01092357a83aba0033b40bd2038997f5f364b97cec0734e8c8134283387fb45db78
|
7
|
+
data.tar.gz: e8ecd9e34667d681ea220fe60715a5238f8bf65f58faa55cbb5a4c2baa602fe717f68c65c325d6d81915038e36300418bd1230e95501b2b7933f090cf7874a13
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## v0.6.1 2015-04-28
|
2
|
+
|
3
|
+
- Changed: Expiration values are always cast to an integer before use in write
|
4
|
+
operations. This prevents subtle ActiveSupport bugs where the value would be
|
5
|
+
ignored by `setex`.
|
6
|
+
|
1
7
|
## v0.6.0 2015-03-09
|
2
8
|
|
3
9
|
- Fixed: Safely handle calling `read_multi` without any keys. [Michael Rykov]
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ rails environment config:
|
|
35
35
|
|
36
36
|
```ruby
|
37
37
|
config.cache_store = :readthis_store, ENV.fetch('REDIS_URL'), {
|
38
|
-
expires_in: 2.weeks,
|
38
|
+
expires_in: 2.weeks.to_i,
|
39
39
|
namespace: 'cache'
|
40
40
|
}
|
41
41
|
```
|
@@ -45,7 +45,7 @@ Otherwise you can use it anywhere, without any reliance on ActiveSupport:
|
|
45
45
|
```ruby
|
46
46
|
require 'readthis'
|
47
47
|
|
48
|
-
cache = Readthis::Cache.new(ENV.fetch('REDIS_URL'), expires_in: 2.weeks)
|
48
|
+
cache = Readthis::Cache.new(ENV.fetch('REDIS_URL'), expires_in: 2.weeks.to_i)
|
49
49
|
```
|
50
50
|
|
51
51
|
You'll want to use a specific database for caching, just in case you need to
|
@@ -56,6 +56,11 @@ redis database, which defaults to 0. For example, using database 2:
|
|
56
56
|
REDIS_URL=redis://localhost:6379/2
|
57
57
|
```
|
58
58
|
|
59
|
+
Be sure to use an integer value when setting expiration time. The default
|
60
|
+
representation of `ActiveSupport::Duration` values won't work when setting
|
61
|
+
expiration time, which will cause all keys to have `-1` as the TTL. Expiration
|
62
|
+
values are always cast as an integer on write.
|
63
|
+
|
59
64
|
[store]: http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
|
60
65
|
|
61
66
|
### Compression
|
data/lib/readthis/cache.rb
CHANGED
@@ -42,7 +42,7 @@ module Readthis
|
|
42
42
|
#
|
43
43
|
def initialize(url, options = {})
|
44
44
|
@expires_in = options.fetch(:expires_in, nil)
|
45
|
-
@namespace = options.fetch(:namespace,
|
45
|
+
@namespace = options.fetch(:namespace, nil)
|
46
46
|
|
47
47
|
@entity = Readthis::Entity.new(
|
48
48
|
marshal: options.fetch(:marshal, Marshal),
|
@@ -323,7 +323,7 @@ module Readthis
|
|
323
323
|
namespaced = namespaced_key(key, options)
|
324
324
|
|
325
325
|
if expiration = options[:expires_in]
|
326
|
-
store.setex(namespaced, expiration, entity.dump(value))
|
326
|
+
store.setex(namespaced, expiration.to_i, entity.dump(value))
|
327
327
|
else
|
328
328
|
store.set(namespaced, entity.dump(value))
|
329
329
|
end
|
data/lib/readthis/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readthis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Selbert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|