fix(core): Update CI workflows and dependencies; apply small bugfixes and formatting improvements
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import * as plugins from './levelcache.plugins.js';
|
||||
import * as paths from './levelcache.paths.js';
|
||||
import { AbstractCache } from './levelcache.abstract.classes.cache.js';
|
||||
import { type ILevelCacheConstructorOptions, LevelCache } from './levelcache.classes.levelcache.js';
|
||||
import {
|
||||
type ILevelCacheConstructorOptions,
|
||||
LevelCache,
|
||||
} from './levelcache.classes.levelcache.js';
|
||||
import { CacheEntry } from './levelcache.classes.cacheentry.js';
|
||||
|
||||
/**
|
||||
@@ -26,10 +29,13 @@ export class CacheDiskManager extends AbstractCache {
|
||||
if (this.levelCacheRef.options.diskStoragePath) {
|
||||
this.fsPath = plugins.path.join(
|
||||
this.levelCacheRef.options.diskStoragePath,
|
||||
this.levelCacheRef.options.cacheId
|
||||
this.levelCacheRef.options.cacheId,
|
||||
);
|
||||
} else {
|
||||
this.fsPath = plugins.path.join(paths.nogitDir, this.levelCacheRef.options.cacheId);
|
||||
this.fsPath = plugins.path.join(
|
||||
paths.nogitDir,
|
||||
this.levelCacheRef.options.cacheId,
|
||||
);
|
||||
}
|
||||
if (this.status === 'active') {
|
||||
plugins.smartfile.fs.ensureDirSync(this.fsPath);
|
||||
@@ -39,7 +45,7 @@ export class CacheDiskManager extends AbstractCache {
|
||||
|
||||
public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> {
|
||||
const fileString = await plugins.smartfile.fs.toStringSync(
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg))
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg)),
|
||||
);
|
||||
return CacheEntry.fromStorageJsonString(fileString);
|
||||
}
|
||||
@@ -47,16 +53,20 @@ export class CacheDiskManager extends AbstractCache {
|
||||
public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) {
|
||||
await plugins.smartfile.memory.toFs(
|
||||
cacheEntryArg.foldToJson(),
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg))
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg)),
|
||||
);
|
||||
}
|
||||
|
||||
public async checkKeyPresence(keyArg: string): Promise<boolean> {
|
||||
return plugins.smartfile.fs.isFile(plugins.path.join(this.fsPath, encodeURIComponent(keyArg)));
|
||||
return plugins.smartfile.fs.isFile(
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg)),
|
||||
);
|
||||
}
|
||||
|
||||
public async deleteCacheEntryByKey(keyArg: string) {
|
||||
await plugins.smartfile.fs.remove(plugins.path.join(this.fsPath, encodeURIComponent(keyArg)));
|
||||
await plugins.smartfile.fs.remove(
|
||||
plugins.path.join(this.fsPath, encodeURIComponent(keyArg)),
|
||||
);
|
||||
}
|
||||
|
||||
public async cleanOutdated() {}
|
||||
|
Reference in New Issue
Block a user