basiccache 0.2.0 → 0.2.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: d4f71e13e981841f75469a57635fb62fa2a05c13
4
- data.tar.gz: 481c5488cb94027f7eeb5c6b73c553efca63c3a7
3
+ metadata.gz: ef69d2ee09a138990c7796e66ce25e985b1c617e
4
+ data.tar.gz: bf2dbe030e3c91ccc7e7aac1b3425d15aa1e5e34
5
5
  SHA512:
6
- metadata.gz: 294d82efd515d209d81c6912feb364acd94cfd7c535186d2354f98d36841a35f8877fa3b2148a38bc8b80bafdd0336d1476a233a6f239652d138de2b3d4c489e
7
- data.tar.gz: b96dd632fad79b12bb513642d179cc7886f7c98d482652a634a9cb3be45ac18df3ded46b6ecbe142dda75099307f98615a1470c605762d08ab5ce089e00c0831
6
+ metadata.gz: 6a9f861cc343763a596113f1b184f62b1106f94d33112b014fbf0e670e351f0694798d7131e6ab99b2f15e309a9d28aed45fb8db37ad2c23b4bce4888d562a55
7
+ data.tar.gz: 70752ee625e1b072ae3d938460f522498413cdaf3833fa243374b2df9ab4583339a75880029127af25f2c9d3f530de5dd60a63ff270198de87059888cdc12866
data/basiccache.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'basiccache'
3
- s.version = '0.2.0'
3
+ s.version = '0.2.1'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.summary = 'Provides a minimal key/value caching layer'
6
6
  s.description = "Allows an application to dynamically cache values and retrieve them later"
@@ -34,8 +34,13 @@ module BasicCache
34
34
  def cache(key = nil, &code)
35
35
  key ||= BasicCache.caller_name
36
36
  key = key.to_sym
37
- @store[key] = TimeCacheItem.new(Time.now, code.call) unless include? key
38
- @store[key].value
37
+ if include? key
38
+ @store[key].value
39
+ else
40
+ value = code.call
41
+ @store[key] = TimeCacheItem.new Time.now, value
42
+ value
43
+ end
39
44
  end
40
45
 
41
46
  ##
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basiccache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker