We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c75d0dd commit 9ddb875Copy full SHA for 9ddb875
README.md
@@ -1 +1,41 @@
1
-# deno-caching
+# Caching
2
+
3
+## `Cache`
4
5
+```ts
6
+const cache = new Cache<string>();
7
8
+const cacheKey = 'abc123';
9
10
+/**
11
+ * Load from cache.
12
+ * If not found, value will be generated and stored in cache.
13
+ */
14
+cache.load(cacheKey, () => {
15
+ const result = 'Lorem ipsum';
16
17
+ // Some expensive operation
18
+ // ...
19
20
+ return result
21
+}); // -> string
22
23
24
25
26
27
+cache.load(cacheKey); // -> string | undefined
28
29
30
31
+ * Save to cache.
32
33
+cache.save(cacheKey, 'Lorem ipsum');
34
35
36
37
+ * Check if cache exists.
38
39
+cache.has(cacheKey); // -> boolean
40
41
+```
0 commit comments