llm_specs 0.2.1 → 0.2.2
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/lib/llm_specs/cache.rb +14 -6
- data/lib/llm_specs/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e800a2dbfee7149fd20468bcbb8f68b0f5f4d30a1fdf86d03cc067d6b36f53
|
4
|
+
data.tar.gz: 75ff11e8f37673d7ac209ba081f32c7b8a12bc461844e84b20a4b553ff9ab5d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca5b4d11c6d3f7b2c4aff772b4cf0170e2c7063091154c5f48ef1010b6e29e803154b37d09ae21cee49c2da6a89afd8b5a2bce527e75b8a02ad35fb55ed3ed75
|
7
|
+
data.tar.gz: 72d975c0c18fc754ed7458b4784c1787beca7363948052567fc3310dda4ad314775025126d65bb84e256a9c04c207e10b2793adb9af4511773606e66b0c159fd
|
data/lib/llm_specs/cache.rb
CHANGED
@@ -10,17 +10,25 @@ module LLMSpecs
|
|
10
10
|
return read if valid?
|
11
11
|
yield.tap { write it }
|
12
12
|
end
|
13
|
-
|
14
|
-
def valid?
|
15
|
-
File.exist?(@file) && (Time.now - File.mtime(@file) < @ttl)
|
16
|
-
end
|
17
|
-
|
13
|
+
|
18
14
|
def read
|
19
15
|
File.read(@file)
|
20
16
|
end
|
21
17
|
|
22
18
|
def write(data)
|
23
|
-
File.write(@file, data)
|
19
|
+
File.write(@file, data)
|
20
|
+
end
|
21
|
+
|
22
|
+
def valid?
|
23
|
+
exist? && fresh?
|
24
|
+
end
|
25
|
+
|
26
|
+
def exist?
|
27
|
+
File.exist?(@file)
|
28
|
+
end
|
29
|
+
|
30
|
+
def fresh?
|
31
|
+
Time.now - File.mtime(@file) < @ttl
|
24
32
|
end
|
25
33
|
end
|
26
34
|
end
|
data/lib/llm_specs/version.rb
CHANGED