Skip to content

Commit db6f6b0

Browse files
committed
Debugged and tested locally.
1 parent 75c2a3c commit db6f6b0

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dist
1212
yarn.lock
1313
shrinkwrap.yaml
1414
package-lock.json
15+
pkg-local

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Parameters
4343
* connectionName - Ignored if storage is not 'redis'. The configured Redis connection name to utilize for the cache.
4444

4545
#### CacheManager.createTLRUCache
46-
Creates a timed LRU (TLRU) cache.
46+
Creates a timed LRU (TLRU) cache. Note that the timeout is a max possible time a cached item can live, not since its last access.
4747

4848
Parameters
4949
* key - the key used to retrieve the cache later
@@ -129,7 +129,7 @@ export default class AppProvider {
129129
Below is an example output of health check metadata info for a user cache. It is not recommended to configure the cache to include items if the cache size is large, as the health check data could become quite large.
130130

131131
```json
132-
"userCache": {
132+
{
133133
"displayName": "User Cache",
134134
"message": "Size 1 of 50",
135135
"meta": {

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
*/
99

1010
export { configure } from './configure.js'
11-
export { CacheItem } from './src/cache.js'
11+
export { type CacheEngineType, CacheItem } from './src/cache.js'
1212
export { CacheHealthCheck } from './src/health_check.js'
13+
export { LRUCache } from './src/lru_cache.js'
14+
export { TLRUCache } from './src/tlru_cache.js'

package.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
"engines": {
66
"node": ">=20.6.0"
77
},
8+
"main": "build/index.js",
89
"type": "module",
910
"files": [
10-
"build/src",
11+
"!build/bin",
12+
"!build/tests",
13+
"build/configure.js",
14+
"build/configure.d.ts",
15+
"build/src/**/*",
1116
"build/providers",
1217
"build/stubs",
1318
"build/index.d.ts",
@@ -33,7 +38,8 @@
3338
"postbuild": "npm run copy:templates",
3439
"release": "np",
3540
"version": "npm run build",
36-
"prepublishOnly": "npm run build"
41+
"prepublishOnly": "npm run build",
42+
"publish:local": "del pkg-local/*.tgz && npm run build && npm pack --pack-destination ./pkg-local"
3743
},
3844
"devDependencies": {
3945
"@adonisjs/assembler": "^7.7.0",
@@ -56,11 +62,11 @@
5662
"typescript": "~5.4.5"
5763
},
5864
"dependencies": {
59-
"@adonisjs/redis": "^9.1.0",
6065
"luxon": "^3.4.4"
6166
},
6267
"peerDependencies": {
63-
"@adonisjs/core": "^6.2.0"
68+
"@adonisjs/core": "^6.2.0",
69+
"@adonisjs/redis": "^9.1.0"
6470
},
6571
"author": "Zeytech Inc (https://zeytech.com)",
6672
"license": "MIT",

src/health_check.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ export class CacheHealthCheck extends BaseCheck {
6161
})
6262
}
6363
}
64-
return Result.ok(`${meta.length} caches reporting statistics`).mergeMetaData(meta)
64+
return Result.ok(
65+
`${meta.length} of ${cacheKeys.length} caches reporting statistics`
66+
).setMetaData(meta)
6567
}
6668
}

src/lru_cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ export class LRUCache<T> {
135135
}
136136

137137
get displayName(): string {
138-
return this.displayName
138+
return this._displayName
139139
}
140140
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"extends": "@adonisjs/tsconfig/tsconfig.package.json",
33
"compilerOptions": {
44
"rootDir": "./",
5-
"outDir": "./build",
5+
"outDir": "./build"
66
}
77
}

0 commit comments

Comments
 (0)