lightly 0.1.0 → 0.1.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/README.md +7 -0
- data/lib/lightly/lightly.rb +5 -5
- data/lib/lightly/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49e684faad48b523195a4ae035b1ab73266f1d86
|
4
|
+
data.tar.gz: 7a5b109eb7b8553a0fb0a303868f45cf4c7fecb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9213c70b1e949ff94950384e7539d5f1c6869e5677a09affdbfa6d409ff8b483775c4bcb7230d7a258a1554640bd8e013ee98630485ee278b358c6c1680ad646
|
7
|
+
data.tar.gz: e369201931051ee110404b3ad87636012aff1665c8ee00c1660a5edd2930a5b9cbf6c0d7e68012d757cabd6fa02eca63747a030baf92c0561e69ffe2f77d52d4
|
data/README.md
CHANGED
@@ -98,6 +98,13 @@ lightly.cached? 'example'
|
|
98
98
|
# => true
|
99
99
|
```
|
100
100
|
|
101
|
+
To flush the cache, call:
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
lightly = Lightly.new
|
105
|
+
lightly.flush
|
106
|
+
```
|
107
|
+
|
101
108
|
The `key` method is an alias to `with`, if you prefer a different wording:
|
102
109
|
|
103
110
|
```ruby
|
data/lib/lightly/lightly.rb
CHANGED
@@ -29,6 +29,11 @@ class Lightly
|
|
29
29
|
@enabled
|
30
30
|
end
|
31
31
|
|
32
|
+
def cached?(key)
|
33
|
+
path = get_path key
|
34
|
+
File.exist? path and !expired? path
|
35
|
+
end
|
36
|
+
|
32
37
|
def enable
|
33
38
|
@enabled = true
|
34
39
|
end
|
@@ -37,11 +42,6 @@ class Lightly
|
|
37
42
|
@enabled = false
|
38
43
|
end
|
39
44
|
|
40
|
-
def cached?(key)
|
41
|
-
path = get_path key
|
42
|
-
File.exist? path and !expired? path
|
43
|
-
end
|
44
|
-
|
45
45
|
private
|
46
46
|
|
47
47
|
def save(key, content)
|
data/lib/lightly/version.rb
CHANGED