@arkstack/cache 0.16.1 → 0.16.3
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/setup.js +8 -0
- package/package.json +4 -4
- package/stubs/config/cache.ts.stub +50 -0
package/dist/setup.js
CHANGED
|
@@ -17,5 +17,13 @@ Publisher.publishes({
|
|
|
17
17
|
to: "src/database/migrations/20260601000000_create_cache_table.ts"
|
|
18
18
|
}]
|
|
19
19
|
});
|
|
20
|
+
Publisher.publishes({
|
|
21
|
+
package: "@arkstack/cache",
|
|
22
|
+
tag: "cache-config",
|
|
23
|
+
entries: [{
|
|
24
|
+
from: join(root, "stubs/config/cache.ts.stub"),
|
|
25
|
+
to: "src/config/cache.ts"
|
|
26
|
+
}]
|
|
27
|
+
});
|
|
20
28
|
//#endregion
|
|
21
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/cache",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cache module for Arkstack, providing a unified, driver based caching layer for the framework.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net/guide/cache",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
"./package.json": "./package.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@arkstack/common": "^0.16.
|
|
36
|
+
"@arkstack/common": "^0.16.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@h3ravel/musket": "^2.2.1",
|
|
40
40
|
"ioredis": "^5.4.1",
|
|
41
|
-
"@arkstack/contract": "^0.16.
|
|
42
|
-
"@arkstack/database": "^0.16.
|
|
41
|
+
"@arkstack/contract": "^0.16.3",
|
|
42
|
+
"@arkstack/database": "^0.16.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
45
45
|
"@arkstack/database": {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Arkstack } from '@arkstack/contract'
|
|
2
|
+
import type { CacheConfig } from '@arkstack/cache'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
|
|
5
|
+
export default (): CacheConfig => {
|
|
6
|
+
return {
|
|
7
|
+
/**
|
|
8
|
+
* Default Cache Store
|
|
9
|
+
*
|
|
10
|
+
* The store used by the framework whenever a store is not explicitly
|
|
11
|
+
* requested. Supported drivers: memory, file, redis, database.
|
|
12
|
+
*/
|
|
13
|
+
default: env('CACHE_STORE', 'memory'),
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Cache Key Prefix
|
|
17
|
+
*
|
|
18
|
+
* Prepended to every cache key to avoid collisions between applications
|
|
19
|
+
* that share the same backing store.
|
|
20
|
+
*/
|
|
21
|
+
prefix: env('CACHE_PREFIX', 'arkstack_cache_'),
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Cache Stores
|
|
25
|
+
*
|
|
26
|
+
* Configure as many stores as you like. Each is referenced by name via
|
|
27
|
+
* `Cache.store('<name>')`.
|
|
28
|
+
*/
|
|
29
|
+
stores: {
|
|
30
|
+
memory: {
|
|
31
|
+
driver: 'memory',
|
|
32
|
+
},
|
|
33
|
+
file: {
|
|
34
|
+
driver: 'file',
|
|
35
|
+
path: path.join(Arkstack.rootDir(), './storage/framework/cache'),
|
|
36
|
+
},
|
|
37
|
+
redis: {
|
|
38
|
+
driver: 'redis',
|
|
39
|
+
host: env('REDIS_HOST', '127.0.0.1'),
|
|
40
|
+
port: env('REDIS_PORT', 6379),
|
|
41
|
+
password: env('REDIS_PASSWORD'),
|
|
42
|
+
db: env('REDIS_CACHE_DB', 1),
|
|
43
|
+
},
|
|
44
|
+
database: {
|
|
45
|
+
driver: 'database',
|
|
46
|
+
table: env('CACHE_TABLE', 'cache'),
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
}
|