lightly 0.1.5 → 0.2.0

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: 1c2942318c34892daf4b704803193ba893439552
4
- data.tar.gz: 8a88022275376cf8f59815329808e9a16e1e7f90
3
+ metadata.gz: 9a343ae5ae80c807c21ae3232b79b9c4f47c17a8
4
+ data.tar.gz: 7da3c16d45bdb06ce8fb16fdef435536a18950a2
5
5
  SHA512:
6
- metadata.gz: 21a98d53fc241456a8870c14a32e482b3dbbed680671cb3efb4f7ae8a0dbdbd219f6143bf4bb50372bbafe7cf8888b9a840dfe800fece5bfbb5b33095f1d821c
7
- data.tar.gz: 06406c0d223ba4f8d14a7968eba81f95f079ec276e13c8368b34157d8a10ae8d73d1a9fd72739dd2808a583c804ad0903f3801a7d53008fd65db048c81f7a13d
6
+ metadata.gz: 06706e26745ca5eae88429319246343919ca64b70c3bbc61b6e33b85059c83121b501d5fdbfb02c4f3c21dd5ca5e44e4d0476286964dd774718b35e0679d73a8
7
+ data.tar.gz: 424ea5fa471dea9c91e785f69586d365011baa11153eb3702e7032ca0467ccce25ecab823af847609388d95a4d9b2ca66357b5490b56df964aa369336d28e704
data/README.md CHANGED
@@ -117,6 +117,17 @@ lightly = Lightly.new
117
117
  lightly.clear 'example'
118
118
  ```
119
119
 
120
+ If your block returns false or nil, the data will not be cached:
121
+
122
+ ```ruby
123
+ result = cache.get 'test' do
124
+ false
125
+ end
126
+
127
+ puts cache.cached? 'test'
128
+ # => false
129
+ ```
130
+
120
131
  ---
121
132
 
122
133
  For a similar gem that provides caching specifically for HTTP downloads,
@@ -15,7 +15,7 @@ class Lightly
15
15
  return load key if cached?(key) && enabled?
16
16
 
17
17
  content = block.call
18
- save key, content if enabled?
18
+ save key, content if content && enabled?
19
19
  content
20
20
  end
21
21
 
@@ -1,3 +1,3 @@
1
1
  class Lightly
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-16 00:00:00.000000000 Z
11
+ date: 2017-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runfile