@robinpath/cache 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.
Files changed (2) hide show
  1. package/README.md +95 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @robinpath/cache
2
+
3
+ > In-memory key-value cache with optional TTL expiration for temporary data storage
4
+
5
+ ![Category](https://img.shields.io/badge/category-Infrastructure-blue) ![Functions](https://img.shields.io/badge/functions-12-green) ![Auth](https://img.shields.io/badge/auth-none-lightgrey) ![License](https://img.shields.io/badge/license-MIT-brightgreen)
6
+
7
+ ## Why use this module?
8
+
9
+ The `cache` module lets you:
10
+
11
+ - Retrieve a value from the cache by key
12
+ - Check if a non-expired key exists in the cache
13
+ - Remove a key from the cache
14
+ - Remove all entries from the cache
15
+ - Get all non-expired keys in the cache
16
+
17
+ All functions are callable directly from RobinPath scripts with a simple, consistent API.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @robinpath/cache
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ No credentials needed — start using it right away:
28
+
29
+ ```robinpath
30
+ cache.get "user:1" "unknown"
31
+ ```
32
+
33
+ ## Available Functions
34
+
35
+ | Function | Description |
36
+ |----------|-------------|
37
+ | `cache.set` | Store a value in the cache with an optional TTL |
38
+ | `cache.get` | Retrieve a value from the cache by key |
39
+ | `cache.has` | Check if a non-expired key exists in the cache |
40
+ | `cache.delete` | Remove a key from the cache |
41
+ | `cache.clear` | Remove all entries from the cache |
42
+ | `cache.keys` | Get all non-expired keys in the cache |
43
+ | `cache.values` | Get all non-expired values in the cache |
44
+ | `cache.size` | Get the number of non-expired entries in the cache |
45
+ | `cache.ttl` | Get the remaining time-to-live for a cache key |
46
+ | `cache.setMany` | Store multiple key-value pairs in the cache at once |
47
+ | `cache.getMany` | Retrieve multiple values from the cache by keys |
48
+ | `cache.deleteMany` | Remove multiple keys from the cache at once |
49
+
50
+ ## Examples
51
+
52
+ ### Retrieve a value from the cache by key
53
+
54
+ ```robinpath
55
+ cache.get "user:1" "unknown"
56
+ ```
57
+
58
+ ### Check if a non-expired key exists in the cache
59
+
60
+ ```robinpath
61
+ cache.has "user:1"
62
+ ```
63
+
64
+ ### Remove a key from the cache
65
+
66
+ ```robinpath
67
+ cache.delete "user:1"
68
+ ```
69
+
70
+ ## Integration with RobinPath
71
+
72
+ ```typescript
73
+ import { RobinPath } from "@wiredwp/robinpath";
74
+ import Module from "@robinpath/cache";
75
+
76
+ const rp = new RobinPath();
77
+ rp.registerModule(Module.name, Module.functions);
78
+ rp.registerModuleMeta(Module.name, Module.functionMetadata);
79
+
80
+ const result = await rp.executeScript(`
81
+ cache.get "user:1" "unknown"
82
+ `);
83
+ ```
84
+
85
+ ## Full API Reference
86
+
87
+ See [MODULE.md](./MODULE.md) for complete documentation including all parameters, return types, error handling, and advanced examples.
88
+
89
+ ## Related Modules
90
+
91
+ - [`@robinpath/json`](../json) — JSON module for complementary functionality
92
+
93
+ ## License
94
+
95
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cache",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },