@checkstack/cache-redis-common 0.1.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # @checkstack/cache-redis-common
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bd41130: feat(cache): add a distributed Redis cache backend
8
+
9
+ Ships `cache-redis-backend` (with its `cache-redis-common` access rules), a
10
+ `CacheProvider` backed by Redis via `ioredis`. Select it in the Infrastructure
11
+ Cache configuration UI to give every pod one shared, coherent cache - this is the
12
+ backend a horizontally-scaled deployment MUST use, since the default in-memory
13
+ backend is per-pod (see the cache-system docs and the in-memory warning in the
14
+ Cache UI).
15
+
16
+ Details:
17
+
18
+ - Values are serialized with `v8.serialize` (structured-clone semantics), not
19
+ JSON, so `Date` / `Map` / `Set` / typed arrays survive the round trip intact -
20
+ several platform caches (e.g. the health-status response's `evaluatedAt` /
21
+ `lastRunAt`) carry `Date`s that JSON would flatten to strings.
22
+ - Honors TTL via `PX`, uses `UNLINK` for non-blocking deletes, and implements
23
+ prefix invalidation with a non-blocking `SCAN` loop (never `KEYS`).
24
+ - Namespaces its keys by folding `instanceRuntime.namespace` into the key prefix
25
+ (`<namespace>:cache:`, or `cache:` for the default instance), so a secondary
26
+ instance (e.g. PR preview) can share one Redis without colliding.
27
+ - `getStats` reports `scope: "cluster"` so the UI can flag it as a shared cache.
28
+
29
+ The dev-server's provider auto-resolution treats `cache-redis-backend` as a
30
+ sibling of `cache-memory-backend`, so wiring Redis in a plugin's deps no longer
31
+ forces the in-memory default to also load.
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@checkstack/cache-redis-common",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "sideEffects": [
6
+ "**/*.css"
7
+ ],
8
+ "main": "src/index.ts",
9
+ "checkstack": {
10
+ "type": "common"
11
+ },
12
+ "dependencies": {
13
+ "@checkstack/common": "0.22.0"
14
+ },
15
+ "devDependencies": {
16
+ "@checkstack/tsconfig": "0.0.7",
17
+ "@checkstack/scripts": "0.7.3"
18
+ },
19
+ "scripts": {
20
+ "typecheck": "tsgo -b",
21
+ "lint": "bun run lint:code",
22
+ "lint:code": "eslint . --max-warnings 0",
23
+ "pack": "bunx @checkstack/scripts plugin-pack"
24
+ },
25
+ "description": "Checkstack cache-redis-common plugin",
26
+ "author": {
27
+ "name": "Checkstack contributors"
28
+ },
29
+ "license": "Elastic-2.0"
30
+ }
package/src/access.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { accessPair, type AccessRule } from "@checkstack/common";
2
+
3
+ /**
4
+ * Access rules for the Redis Cache plugin.
5
+ */
6
+ export const cacheRedisAccess = accessPair(
7
+ "cache-redis",
8
+ {
9
+ read: { description: "View Redis cache configuration and statistics" },
10
+ manage: { description: "Modify Redis cache configuration" },
11
+ },
12
+ // Must match the backend plugin id (cache-redis-backend) that registers these.
13
+ { pluginId: "cache-redis" },
14
+ );
15
+
16
+ /**
17
+ * All access rules for registration with the plugin system.
18
+ */
19
+ export const cacheRedisAccessRules: AccessRule[] = [
20
+ cacheRedisAccess.read,
21
+ cacheRedisAccess.manage,
22
+ ];
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { cacheRedisAccess, cacheRedisAccessRules } from "./access";
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "@checkstack/tsconfig/common.json",
3
+ "include": [
4
+ "src"
5
+ ],
6
+ "references": [
7
+ {
8
+ "path": "../../core/common"
9
+ }
10
+ ]
11
+ }