From 26511fc10e55732ef5dbfa7333cbfc287c4328d9 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 14 Feb 2020 18:10:10 +0000 Subject: [PATCH] fix(core): update --- package.json | 3 ++- ts/levelcache.classes.cacheentry.ts | 7 ++++++- ts/levelcache.classes.cacherouter.ts | 6 ++++++ ts/levelcache.classes.levelcache.ts | 28 +++++++++++++++++++++++----- ts/levelcache.plugins.ts | 4 +++- 5 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 ts/levelcache.classes.cacherouter.ts diff --git a/package.json b/package.json index ddb4efc..59e7aee 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "@pushrocks/smartbucket": "^1.0.24", "@pushrocks/smartcache": "^1.0.13", "@pushrocks/smartfile": "^7.0.6", - "@pushrocks/smartstring": "^3.0.18" + "@pushrocks/smartstring": "^3.0.18", + "@pushrocks/smartunique": "^3.0.1" }, "files": [ "ts/**/*", diff --git a/ts/levelcache.classes.cacheentry.ts b/ts/levelcache.classes.cacheentry.ts index 7910909..e5ec00b 100644 --- a/ts/levelcache.classes.cacheentry.ts +++ b/ts/levelcache.classes.cacheentry.ts @@ -1,5 +1,10 @@ import * as plugins from './levelcache.plugins'; export class CacheEntry { - + type: 'string' | 'blob'; + mode: 'complete' | 'stream'; + keyArg: string; + cacheStream: ReadableStream; + cacheContents: Buffer; + cacheValue: string; } \ No newline at end of file diff --git a/ts/levelcache.classes.cacherouter.ts b/ts/levelcache.classes.cacherouter.ts new file mode 100644 index 0000000..3da457d --- /dev/null +++ b/ts/levelcache.classes.cacherouter.ts @@ -0,0 +1,6 @@ +import * as plugins from './levelcache.plugins'; + +export class CacheRouter { + async routeStoreAction() {} + async routeRetrieveAction() {} +} \ No newline at end of file diff --git a/ts/levelcache.classes.levelcache.ts b/ts/levelcache.classes.levelcache.ts index 2581127..67d3ba7 100644 --- a/ts/levelcache.classes.levelcache.ts +++ b/ts/levelcache.classes.levelcache.ts @@ -2,6 +2,7 @@ import * as plugins from './levelcache.plugins'; import { CacheDiskManager } from './levelcache.classes.cache.diskmanager'; import { CacheMemoryManager } from './levelcache.classes.cache.memorymanager'; import { CacheS3Manager } from './levelcache.classes.cache.s3manager'; +import { CacheEntry } from './levelcache.classes.cacheentry'; /** * a leveled cache for storing things for a short time @@ -12,31 +13,48 @@ export class LevelCache { public cacheMemoryManager = new CacheMemoryManager(); public cacheS3Manager = new CacheS3Manager(); + private processKey (keyArg: string) { + if (!keyArg) { + return plugins.smartunique.shortId(); + } + } + // Blobs /** * store a Blob */ - public async storeBlobByKey () {}; + public async storeBlobByKey (keyArg: string, blob: Buffer) { + keyArg = this.processKey(keyArg); + return keyArg; + } /** * retrieve a blob */ - public async retrieveBlob () {}; + public async retrieveBlob (keyArg: string): CacheEntry { + + } // Cache Entries /** * store a Cache Entries */ - public async storeCacheEntry() {}; + public async storeCacheEntry(cacheEntryArg: CacheEntry): string { + + } /** * retrieve cache entry */ - public async retrieveCacheEntry () {}; + public async retrieveCacheEntry (): CacheEntry { + + } /** * cleans the cache */ - public clean() {}; + public clean() { + + }; } diff --git a/ts/levelcache.plugins.ts b/ts/levelcache.plugins.ts index 7a0d66a..7186112 100644 --- a/ts/levelcache.plugins.ts +++ b/ts/levelcache.plugins.ts @@ -11,11 +11,13 @@ import * as smartbucket from '@pushrocks/smartbucket'; import * as smartcache from '@pushrocks/smartcache'; import * as smartfile from '@pushrocks/smartfile'; import * as smartstring from '@pushrocks/smartstring'; +import * as smartunique from '@pushrocks/smartunique'; export { lik, smartbucket, smartcache, smartfile, - smartstring + smartstring, + smartunique };