You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/06-Adapters/07-key-value-adapters.md
+98-3Lines changed: 98 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Key-value adapters are used to store data in a key-value format. They provide a
11
11
## RAM Adapter
12
12
13
13
```bash
14
-
pnpm i @adminforth/key-value-adapter-ram
14
+
pnpm add @adminforth/key-value-adapter-ram
15
15
```
16
16
17
17
The RAM adapter is a simple in-memory key-value store. It keeps data in process memory, so it is not suitable for multi-process deployments because each process would have its own isolated store. In that case you need a centralized KV adapter such as Redis.
@@ -27,7 +27,7 @@ Cons:
27
27
## Redis Adapter
28
28
29
29
```bash
30
-
pnpm i @adminforth/key-value-adapter-redis
30
+
pnpm add @adminforth/key-value-adapter-redis
31
31
```
32
32
33
33
Redis uses in-memory storage with $O(1)$ get complexity. It is a great fit for lightweight workloads that fit in RAM, and it also works well for multi-process or replica-based installations as a centralized store. If persistence across restarts is important, configure Redis persistence separately.
LevelDB uses disk storage with $O(\log n)$ get complexity. It is a good fit for large or persistent KV datasets that still require fast lookups but do not efficiently fit in RAM. This is a single-process adapter only, so multiple admin processes should not point to the same LevelDB directory.
@@ -60,4 +60,99 @@ const adapter = new LevelDBKeyValueAdapter({
60
60
});
61
61
62
62
adapter.set('test-key', 'test-value', 120);
63
+
```
64
+
65
+
## Resource-based adapter
66
+
```bash
67
+
pnpm add @adminforth/key-value-adapter-resource
68
+
```
69
+
70
+
Resource adapter uses adminforth resource to store key/value pairs.
0 commit comments