fix(core): update

This commit is contained in:
2021-04-23 18:40:57 +00:00
parent be8227f451
commit e53ebc74f8
15 changed files with 12810 additions and 1177 deletions

View File

@@ -1,20 +1,38 @@
import * as plugins from './levelcache.plugins';
export interface ICacheEntryConstructorOptions {}
export interface ICacheEntryConstructorOptions {
key?: string;
ttl: number;
typeInfo?: string;
contents: Buffer;
}
/**
* a CacheEntry
*/
export class CacheEntry {
public static fromBuffer() {}
public static fromString() {}
export class CacheEntry extends plugins.smartjson.Smartjson implements ICacheEntryConstructorOptions {
public static fromStorageJsonString(storageJsonString: string) {
return new CacheEntry(plugins.smartjson.parse(storageJsonString));
}
type: 'string' | 'blob';
mode: 'complete' | 'stream';
keyArg: string;
cacheStream: ReadableStream;
cacheContents: Buffer;
cacheValue: string;
@plugins.smartjson.foldDec()
public key: string;
constructor(optionsArg: {}) {}
@plugins.smartjson.foldDec()
public ttl: number;
@plugins.smartjson.foldDec()
public typeInfo: string;
@plugins.smartjson.foldDec()
contents: Buffer;
public toStorageJsonString(): string {
return this.foldToJson();
}
constructor(optionsArg: ICacheEntryConstructorOptions) {
super();
Object.assign(this, optionsArg);
}
}