@stacksjs/cache 0.69.3 → 0.70.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/dist/memory.d.ts CHANGED
@@ -1,4 +1,18 @@
1
- import type { CacheDriver } from '@stacksjs/types';
1
+ export declare class MemoryCacheDriver extends BaseCacheDriver {
2
+ constructor(options: { maxSize?: number, maxItems?: number } = {}) {
3
+ const client = new BentoCache({
4
+ default: 'memory',
5
+ stores: {
6
+ memory: bentostore().useL1Layer(
7
+ memoryDriver({
8
+ maxSize: options.maxSize ?? 10 * 1024 * 1024,
9
+ maxItems: options.maxItems ?? 1000,
10
+ }),
11
+ ),
12
+ },
13
+ })
2
14
 
3
- declare const client: unknown;
4
- export declare const memory: CacheDriver;
15
+ super(client)
16
+ }
17
+ }
18
+ export declare const memory: MemoryCacheDriver;
package/dist/redis.d.ts CHANGED
@@ -1,4 +1,32 @@
1
- import type { CacheDriver } from '@stacksjs/types';
1
+ export declare interface RedisOptions {
2
+ host?: string
3
+ port?: number
4
+ username?: string
5
+ password?: string
6
+ db?: number
7
+ tls?: boolean
8
+ }
9
+ export declare class RedisCacheDriver extends BaseCacheDriver {
10
+ constructor(options: RedisOptions = {}) {
11
+ const client = new BentoCache({
12
+ default: 'redis',
13
+ stores: {
14
+ redis: bentostore().useL2Layer(
15
+ redisDriver({
16
+ connection: {
17
+ host: options.host ?? '127.0.0.1',
18
+ port: options.port ?? 6379,
19
+ ...(options.username && { username: options.username }),
20
+ ...(options.password && { password: options.password }),
21
+ ...(options.db !== undefined && { db: options.db }),
22
+ ...(options.tls && { tls: {} }),
23
+ },
24
+ }),
25
+ ),
26
+ },
27
+ })
2
28
 
3
- declare const client: unknown;
4
- export declare const redis: CacheDriver;
29
+ super(client)
30
+ }
31
+ }
32
+ export declare const redis: RedisCacheDriver;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/cache",
3
3
  "type": "module",
4
- "version": "0.69.3",
4
+ "version": "0.70.0",
5
5
  "description": "Caching the Stacks way.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": ["Chris Breuer <chris@stacksjs.org>"],
@@ -41,11 +41,11 @@
41
41
  "prepublishOnly": "bun run build"
42
42
  },
43
43
  "devDependencies": {
44
- "@aws-sdk/client-dynamodb": "^3.751.0",
45
- "@stacksjs/config": "0.69.2",
46
- "@stacksjs/development": "0.69.2",
47
- "bentocache": "^1.2.0",
44
+ "@aws-sdk/client-dynamodb": "^3.772.0",
45
+ "@stacksjs/config": "0.70.0",
46
+ "@stacksjs/development": "0.70.0",
47
+ "bentocache": "^1.2.1",
48
48
  "dynamodb-tooling": "^0.3.2",
49
- "ioredis": "^5.5.0"
49
+ "ioredis": "^5.6.0"
50
50
  }
51
51
  }