4 Commits

Author SHA1 Message Date
92b858e248 1.0.5 2020-02-14 18:10:10 +00:00
26511fc10e fix(core): update 2020-02-14 18:10:10 +00:00
1cdba38408 1.0.4 2020-02-14 17:28:14 +00:00
7a0525bd1f fix(core): update 2020-02-14 17:28:13 +00:00
11 changed files with 90 additions and 13 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/levelcache",
"version": "1.0.3",
"version": "1.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@pushrocks/levelcache",
"version": "1.0.3",
"version": "1.0.5",
"private": false,
"description": "a cache that uses memory/disk/s3 as backup",
"main": "dist/index.js",
@@ -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/**/*",

View File

@@ -1,8 +1,15 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as levelcache from '../ts/index';
tap.test('first test', async () => {
console.log('hi');
let testLevelCache: levelcache.LevelCache;
tap.test('should create a new levelcache instance', async () => {
testLevelCache = new levelcache.LevelCache();
expect(testLevelCache).to.be.instanceOf(levelcache.LevelCache);
});
tap.test('should cache a value', async () => {
});
tap.start();

View File

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

View File

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

View File

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

View File

@@ -1 +1,10 @@
import * as plugins from './levelcache.plugins';
import * as plugins from './levelcache.plugins';
export class CacheEntry {
type: 'string' | 'blob';
mode: 'complete' | 'stream';
keyArg: string;
cacheStream: ReadableStream;
cacheContents: Buffer;
cacheValue: string;
}

View File

@@ -0,0 +1,6 @@
import * as plugins from './levelcache.plugins';
export class CacheRouter {
async routeStoreAction() {}
async routeRetrieveAction() {}
}

View File

@@ -1,29 +1,60 @@
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
*/
export class LevelCache {
public cacheMap = new plugins.lik.Objectmap();
public cacheDiskManager = new CacheDiskManager();
public cacheMemoryManager = new CacheMemoryManager();
public cacheS3Manager = new CacheS3Manager();
private processKey (keyArg: string) {
if (!keyArg) {
return plugins.smartunique.shortId();
}
}
// Blobs
/**
* store a Blob
*/
public async storeBlob () {};
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 {
}
// Cachen Entries
// Cache Entries
/**
* store a Cache Entries
*/
public async storeCacheEntry() {};
public async retrieveCacheEntry () {};
public async storeCacheEntry(cacheEntryArg: CacheEntry): string {
}
public clean() {}
/**
* retrieve cache entry
*/
public async retrieveCacheEntry (): CacheEntry {
}
/**
* cleans the cache
*/
public clean() {
};
}

View File

@@ -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
};