@nowarajs/elysia-cache 1.3.4 → 1.3.6

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/README.md CHANGED
@@ -21,8 +21,6 @@
21
21
 
22
22
  ## 📝 Description
23
23
 
24
- > High-performance caching plugin for Elysia.js with flexible storage backends.
25
-
26
24
  **Elysia Cache** provides a simple yet powerful caching system for Elysia.js applications. It supports both in-memory caching and custom storage backends through the `@nowarajs/kv-store` ecosystem, automatic cache key generation based on request parameters, TTL management, and HTTP cache headers for optimal performance and client awareness.
27
25
 
28
26
  ## ✨ Features
@@ -63,7 +61,7 @@ const app = new Elysia()
63
61
  return await fetchUsers()
64
62
  }, {
65
63
  isCached: {
66
- ttl: 300 // Cache for 5 minutes
64
+ ttl: 300 // Cache for 5 minutes
67
65
  }
68
66
  })
69
67
  .listen(3000)
@@ -103,13 +101,13 @@ const app = new Elysia()
103
101
  const app = new Elysia()
104
102
  .use(cache())
105
103
  .get('/fast', () => getData(), {
106
- isCached: { ttl: 30 } // Cache for 30 seconds
104
+ isCached: { ttl: 30 } // Cache for 30 seconds
107
105
  })
108
106
  .get('/slow', () => getSlowData(), {
109
- isCached: { ttl: 3600 } // Cache for 1 hour
107
+ isCached: { ttl: 3600 } // Cache for 1 hour
110
108
  })
111
109
  .get('/prefixed', () => getData(), {
112
- isCached: { ttl: 60, prefix: 'api:' } // With custom prefix
110
+ isCached: { ttl: 60, prefix: 'api:' } // With custom prefix
113
111
  })
114
112
  ```
115
113
 
@@ -121,7 +119,7 @@ You can apply caching to multiple routes at once using Elysia's `.guard()`:
121
119
  const app = new Elysia()
122
120
  .use(cache())
123
121
  .guard({
124
- isCached: { ttl: 60 } // Apply to all routes in this guard
122
+ isCached: { ttl: 60 } // Apply to all routes in this guard
125
123
  })
126
124
  .get('/users', () => getUsers())
127
125
  .get('/posts', () => getPosts())
@@ -161,7 +159,7 @@ X-Cache: HIT
161
159
 
162
160
  You can find the complete API reference documentation for `Elysia Cache` at:
163
161
 
164
- - [TypeDoc Documentation](https://nowarajs.github.io/elysia-cache)
162
+ - [Reference Documentation](https://nowarajs.github.io/elysia-cache)
165
163
 
166
164
  ## ⚖️ License
167
165
 
package/dist/cache.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { KvStore } from '@nowarajs/kv-store/types';
2
- import { Elysia, type DefinitionBase, type MetadataBase, type SingletonBase } from 'elysia';
2
+ import { Elysia } from 'elysia';
3
3
  import type { CacheOptions } from './types/cache-options';
4
4
  /**
5
5
  * Response caching plugin for Elysia applications.
@@ -10,8 +10,21 @@ import type { CacheOptions } from './types/cache-options';
10
10
  * @param store - KV store for caching. Defaults to in-memory.
11
11
  * @returns Elysia plugin with `isCached` macro
12
12
  */
13
- export declare const cache: (store?: KvStore) => Elysia<"", SingletonBase, DefinitionBase, MetadataBase & {
13
+ export declare const cache: (store?: KvStore) => Elysia<"", {
14
+ decorator: {};
15
+ derive: {};
16
+ resolve: {};
17
+ store: {};
18
+ }, {
19
+ typebox: {};
20
+ error: {};
21
+ }, {
14
22
  macro: Partial<{
15
23
  readonly isCached: CacheOptions;
16
24
  }>;
25
+ macroFn: {};
26
+ parser: {};
27
+ response: {};
28
+ schema: {};
29
+ standaloneSchema: {};
17
30
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowarajs/elysia-cache",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "author": "NowaraJS",
5
5
  "description": "A template to create a bun package.",
6
6
  "type": "module",