fix(core): update

This commit is contained in:
2020-02-15 22:38:28 +00:00
parent 92b858e248
commit d8f526ef2d
10 changed files with 73 additions and 61 deletions

View File

@ -1,8 +1,6 @@
import * as plugins from './levelcache.plugins';
/**
*
*
*/
export class CacheDiskManager {
}
export class CacheDiskManager {}

View File

@ -1,5 +1,3 @@
import * as plugins from './levelcache.plugins';
export class CacheMemoryManager {
}
export class CacheMemoryManager {}

View File

@ -1,8 +1,6 @@
import * as plugins from './levelcache.plugins';
/**
*
*
*/
export class CacheS3Manager {
}
export class CacheS3Manager {}

View File

@ -1,10 +1,20 @@
import * as plugins from './levelcache.plugins';
export interface ICacheEntryConstructorOptions {}
/**
* a CacheEntry
*/
export class CacheEntry {
public static fromBuffer() {}
public static fromString() {}
type: 'string' | 'blob';
mode: 'complete' | 'stream';
keyArg: string;
cacheStream: ReadableStream;
cacheContents: Buffer;
cacheValue: string;
}
constructor(optionsArg: {}) {}
}

View File

@ -1,6 +1,21 @@
import * as plugins from './levelcache.plugins';
import { LevelCache } from './levelcache.classes.levelcache';
export class CacheRouter {
async routeStoreAction() {}
async routeRetrieveAction() {}
}
public levelCacheRef: LevelCache;
public cacheMap;
constructor(levelCacheRef: LevelCache) {
this.levelCacheRef = levelCacheRef;
}
/**
* gets the relevant cache to perform a store action on
*/
async getCacheForStoreAction() {}
/**
* gets the relevant cache to perform a retrieval action on
*/
async getCacheForRetrieveAction() {}
}

View File

@ -3,17 +3,31 @@ 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';
import { CacheRouter } from './levelcache.classes.cacherouter';
export interface ILevelCacheConstructorOptions {
maxMemoryStorageInMB: number;
maxDiskStorageInMB: number;
maxS3StorageInMB?: number;
smartbucketConfig?: plugins.smartbucket.ISmartBucketConfig;
}
/**
* a leveled cache for storing things for a short time
*/
export class LevelCache {
public cacheMap = new plugins.lik.Objectmap();
public cacheRouter = new CacheRouter(this);
public cacheDiskManager = new CacheDiskManager();
public cacheMemoryManager = new CacheMemoryManager();
public cacheS3Manager = new CacheS3Manager();
private processKey (keyArg: string) {
public options: ILevelCacheConstructorOptions;
constructor(optionsArg: ILevelCacheConstructorOptions) {
this.options = optionsArg;
}
private processKey(keyArg: string) {
if (!keyArg) {
return plugins.smartunique.shortId();
}
@ -23,7 +37,7 @@ export class LevelCache {
/**
* store a Blob
*/
public async storeBlobByKey (keyArg: string, blob: Buffer) {
public async storeBlobByKey(keyArg: string, blob: Buffer) {
keyArg = this.processKey(keyArg);
return keyArg;
}
@ -31,30 +45,16 @@ export class LevelCache {
/**
* retrieve a blob
*/
public async retrieveBlob (keyArg: string): CacheEntry {
}
public async retrieveBlob(keyArg: string): CacheEntry {}
// Cache Entries
/**
* store a Cache Entries
*/
public async storeCacheEntry(cacheEntryArg: CacheEntry): string {
}
/**
* retrieve cache entry
*/
public async retrieveCacheEntry (): CacheEntry {
}
public async retrieveCacheEntryByKey(): CacheEntry {}
/**
* cleans the cache
*/
public clean() {
};
public clean() {}
}

View File

@ -1,9 +1,7 @@
// node native scope
import * as path from 'path';
export {
path
}
export { path };
// @pushrocks scope
import * as lik from '@pushrocks/lik';
@ -13,11 +11,4 @@ import * as smartfile from '@pushrocks/smartfile';
import * as smartstring from '@pushrocks/smartstring';
import * as smartunique from '@pushrocks/smartunique';
export {
lik,
smartbucket,
smartcache,
smartfile,
smartstring,
smartunique
};
export { lik, smartbucket, smartcache, smartfile, smartstring, smartunique };