fix(core): Fix S3 cache manager methods for better path encoding consistency
This commit is contained in:
parent
69b2aa7fb8
commit
8bf1af08d3
@ -119,6 +119,6 @@ jobs:
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @gitzone/tsdoc
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
||||
|
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-11-26 - 3.1.1 - fix(core)
|
||||
Fix S3 cache manager methods for better path encoding consistency
|
||||
|
||||
- Corrected path parameter usage in S3 manager methods to ensure encoding and consistency.
|
||||
- Updated package.json Git dependencies for scoped packages.
|
||||
|
||||
## 2024-11-24 - 3.1.0 - feat(core)
|
||||
Enhanced caching solution with optional configurations and improved documentation.
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.66",
|
||||
"@gitzone/tsrun": "^1.2.44",
|
||||
"@gitzone/tstest": "^1.0.77",
|
||||
"@git.zone/tsbuild": "^2.1.66",
|
||||
"@git.zone/tsrun": "^1.2.44",
|
||||
"@git.zone/tstest": "^1.0.77",
|
||||
"@push.rocks/tapbundle": "^5.5.3",
|
||||
"@types/node": "^22.9.3"
|
||||
},
|
||||
|
4379
pnpm-lock.yaml
generated
4379
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
10
readme.md
10
readme.md
@ -1,4 +1,3 @@
|
||||
```markdown
|
||||
# @push.rocks/levelcache
|
||||
A cache that utilizes memory, disk, and S3 for data storage and backup.
|
||||
|
||||
@ -154,15 +153,6 @@ const largeDatasetCache = new LevelCache({
|
||||
|
||||
With intelligent routing and management embedded, `LevelCache` ensures optimal trade-offs between speed and stability.
|
||||
|
||||
### Conclusion
|
||||
|
||||
By adapting to bespoke caching styles and leveraging extensive storage structures (in-memory, on-disk, and cloud-based), `@push.rocks/levelcache` can handle varied data caching use-cases with ease. Whether you're aiming for top-tier speed for volatile data or need extended persistence for critical datasets, configure `LevelCache` to excellently complement your operational context.
|
||||
|
||||
Explore the package further through testing and customization, ensuring you're getting the most benefit from integrated features and storage mechanisms. The robustness of `@push.rocks/levelcache` consistently optimizes the caching and retrieval process across different runtime environments.
|
||||
|
||||
We recommend examining your own application's storage behavior taxonomy; this helps frame caching strategies that consider both speed and durability requirements. Integrate `@push.rocks/levelcache` as a billing cornerstone of your system’s architecture built on TypeScript and Node.js, embracing luxury control over resource use and performance elevation.
|
||||
```
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/levelcache',
|
||||
version: '3.1.0',
|
||||
version: '3.1.1',
|
||||
description: 'A versatile caching solution offering multi-level storage utilizing memory, disk, and Amazon S3 for efficient data management and backup.'
|
||||
}
|
||||
|
@ -42,16 +42,18 @@ export class CacheS3Manager extends AbstractCache {
|
||||
}
|
||||
|
||||
public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> {
|
||||
const jsonFileString = (await this.s3CacheDir.fastGet(encodeURIComponent(keyArg))).toString();
|
||||
const jsonFileString = (await this.s3CacheDir.fastGet({
|
||||
path: encodeURIComponent(keyArg),
|
||||
})).toString();
|
||||
const cacheEntry = CacheEntry.fromStorageJsonString(jsonFileString);
|
||||
return cacheEntry;
|
||||
}
|
||||
|
||||
public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) {
|
||||
await this.s3CacheDir.fastStore(
|
||||
encodeURIComponent(keyArg),
|
||||
cacheEntryArg.toStorageJsonString()
|
||||
);
|
||||
await this.s3CacheDir.fastPut({
|
||||
path: encodeURIComponent(keyArg),
|
||||
contents: cacheEntryArg.toStorageJsonString()
|
||||
});
|
||||
}
|
||||
|
||||
public async checkKeyPresence(keyArg: string): Promise<boolean> {
|
||||
@ -66,7 +68,9 @@ export class CacheS3Manager extends AbstractCache {
|
||||
|
||||
public async deleteCacheEntryByKey(keyArg: string) {
|
||||
if (this.status === 'active') {
|
||||
await this.s3CacheDir.fastRemove(encodeURIComponent(keyArg));
|
||||
await this.s3CacheDir.fastRemove({
|
||||
path: encodeURIComponent(keyArg),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +80,8 @@ export class CacheS3Manager extends AbstractCache {
|
||||
public async cleanOutdated() {}
|
||||
|
||||
public async cleanAll() {
|
||||
await this.s3CacheDir.deleteWithAllContents();
|
||||
await this.s3CacheDir.delete({
|
||||
mode: 'permanent',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,7 @@
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"strict": true
|
||||
"verbatimModuleSyntax": true
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
Loading…
Reference in New Issue
Block a user