mrcr-cache 0.1.3 → 0.1.4

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: 68937874ebb9acd1a342d6490bb9402ade0cf194
4
- data.tar.gz: d5a2364d9d2055575649a94f5c31b860939da473
3
+ metadata.gz: d8ac8ff74107302655d943ee533b14e13b80ca82
4
+ data.tar.gz: b0a100b970e79b8894bef170a1c76eed121efb7b
5
5
  SHA512:
6
- metadata.gz: f155318bc654e2be477d985b293e1e793e75a348531b4f3ea419a51727e58bced8391ea844453552232245579fd7e663b56ceafa4fb49f24d9c3e109d4d65a60
7
- data.tar.gz: b3ffad3a2d51ca7c1b53edd7f6fb773983afcb649e56cb1ab1664a7c084db49f7f44f54e30e410b356781b70745d6ba8210034756c89930cf5551d1bb843990f
6
+ metadata.gz: 32a037fe6f66ace14eb7c9a7ea1a637081d540d1e9da55aef3d84d3026267830d5b801fa8ce5acd537fd0c50563d391aba95968791f5147e1192296cb695e4a6
7
+ data.tar.gz: b9c5d2d059e056092dcd3e1dd2872f49ed3362b5ef51effcc910c51523c7ed4720951dcaed1e64fa88339c47f69b1c48505537399e05c963576126000163ab9a
data/README.md CHANGED
@@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
36
36
  ## Thanks
37
37
 
38
38
  - This project is a copy of cache module from https://github.com/dry-rb/dry-core.
39
- It made well done, but extracted for better support for our own needs, as it primary uses `concurrent-ruby`.
39
+ Extracted for better support for our own needs(fetch feature), as it primary uses only `concurrent-ruby`.
40
40
 
41
41
  ## Contributing
42
42
 
data/lib/mrcr/cache.rb CHANGED
@@ -50,17 +50,14 @@ module Mrcr
50
50
  cache.fetch_or_store(key.hash, &block)
51
51
  end
52
52
 
53
- # Caches a result of the block evaluation
53
+ # Fetch a cache by key & default
54
54
  #
55
55
  # @param [Object] key Hashable object
56
56
  # @param [Object] default Default value
57
- # @yield An arbitrary block
58
57
  #
59
- # @note beware Proc instance hashes are not equal, i.e. -> { 1 }.hash != -> { 1 }.hash,
60
- # this means you shouldn't pass Procs in args unless you're sure
61
- # they are always the same instances, otherwise you introduce a memory leak
58
+ # @note (see #fetch_or_store)
62
59
  #
63
- # @return [Object] block's return value (cached for subsequent calls with the same argument values)
60
+ # @return [Object] return value or default
64
61
  def fetch(key, default = nil)
65
62
  cache.fetch(key.hash, default)
66
63
  end
@@ -81,9 +78,8 @@ module Mrcr
81
78
  #
82
79
  # @param [Object] key Hashable object
83
80
  # @param [Object] default Default value.
84
- # @yield An arbitrary block
85
81
  #
86
- # @return [Object] block's return value
82
+ # @return [Object] return value or default
87
83
  def fetch(key, default = nil)
88
84
  self.class.fetch(key, default)
89
85
  end
@@ -1,5 +1,5 @@
1
1
  module Mrcr
2
2
  module Cache
3
- VERSION = '0.1.3'.freeze
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrcr-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Merkulov