readthis 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55fdafde7fa30d64c803d3952bf663d08c8c3f7a
4
- data.tar.gz: 4f69451b0992644c1bf160bdd4d2a1b68bf3e495
3
+ metadata.gz: 526a587fdb24dce81997fc27843cea6e4f3ae5f0
4
+ data.tar.gz: 545038b4b9ccd67e896a67c2bae81d8644fed8dc
5
5
  SHA512:
6
- metadata.gz: 3602ac1b8a9296aef0c802b3cbd60b9689b496fe0efa9086024e4cbd69afa91dd59f57c1f0882ad4be933ddb678bd4039642dc679f55c65547366426d09f0cba
7
- data.tar.gz: 121272db5ae46a67209ef7644bd2a352b197373222f608b5d53d981369f37fea410fd9d5e4a20e313432ac1dda12b95d7323cb606f6db44d169caed8405dc794
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
@@ -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, nil)
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
@@ -1,3 +1,3 @@
1
1
  module Readthis
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
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.0
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-03-09 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis