8 Commits

Author SHA1 Message Date
be8227f451 1.0.6 2020-02-15 22:38:29 +00:00
d8f526ef2d fix(core): update 2020-02-15 22:38:28 +00:00
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
a1cb632d26 1.0.3 2020-02-06 16:55:56 +00:00
47aa1681bf fix(core): update 2020-02-06 16:55:55 +00:00
11 changed files with 183 additions and 39 deletions

74
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/levelcache",
"version": "1.0.2",
"version": "1.0.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -98,14 +98,15 @@
}
},
"@pushrocks/lik": {
"version": "3.0.13",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.13.tgz",
"integrity": "sha512-YDxYoh2UksEfUxcjSjTwLsW5j852E5FrMG62CUi1I7ZpBxf96b7P1t2pRWsQsNnHRz6FHckW/A1V6XKASB+jZA==",
"version": "3.0.18",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.18.tgz",
"integrity": "sha512-H/6yN9Ci0lIRvv8klOwNtLid9v+Owjk0ehumHLfOUkEUklJPbgSDOli+DlWbyO80RBGtQJyHR5xjOMnnaBzOhg==",
"requires": {
"@pushrocks/smartdelay": "^2.0.6",
"@pushrocks/smartpromise": "^3.0.6",
"@pushrocks/smartrx": "^2.0.5",
"@pushrocks/smarttime": "^3.0.12",
"@pushrocks/smartunique": "^3.0.1",
"@types/minimatch": "^3.0.3",
"minimatch": "^3.0.4",
"symbol-tree": "^3.2.4"
@ -213,9 +214,9 @@
}
},
"@pushrocks/smartfile": {
"version": "7.0.6",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.6.tgz",
"integrity": "sha512-X1kWg1HSQ/MqasRIHPCf6D9CRrcIrpTjW8KLc4GkApJ/W/IVaKsQkJQfdimlg1uc/9v8AYnoRdiGa51yxyghZA==",
"version": "7.0.8",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartfile/-/smartfile-7.0.8.tgz",
"integrity": "sha512-cNxTs+vyuegAV7HayoobQIAbO4j+XEMoEl9nbnehHhmxdt26/Gin6+eqWn/5/OEJj5EggrrZftFJQMzdJ50dDQ==",
"requires": {
"@pushrocks/smarthash": "^2.0.6",
"@pushrocks/smartpath": "^4.0.1",
@ -354,6 +355,17 @@
"luxon": "^1.16.0"
}
},
"@pushrocks/smartunique": {
"version": "3.0.1",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartunique/-/smartunique-3.0.1.tgz",
"integrity": "sha512-xBu9ZB4C0BA0S/pbFFZn2ItPfnodPKpzrYIq1yN5XDs6OaookwcDF/iBwfS9+EYMSPENC9wAsOxg2RGMm4Qicw==",
"requires": {
"@types/shortid": "^0.0.29",
"@types/uuid": "^3.0.0",
"shortid": "^2.2.8",
"uuid": "^3.1.0"
}
},
"@pushrocks/streamfunction": {
"version": "1.0.24",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fstreamfunction/-/streamfunction-1.0.24.tgz",
@ -468,9 +480,14 @@
}
},
"@types/node": {
"version": "10.17.14",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-10.17.14.tgz",
"integrity": "sha512-G0UmX5uKEmW+ZAhmZ6PLTQ5eu/VPaT+d/tdLd5IFsKRPcbe6lPxocBtcYBFSaLaCW8O60AX90e91Nsp8lVHCNw=="
"version": "13.7.1",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.1.tgz",
"integrity": "sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA=="
},
"@types/shortid": {
"version": "0.0.29",
"resolved": "https://verdaccio.lossless.one/@types%2fshortid/-/shortid-0.0.29.tgz",
"integrity": "sha1-gJPuBBam4r8qpjOBCRFLP7/6Dps="
},
"@types/through2": {
"version": "2.0.34",
@ -480,6 +497,11 @@
"@types/node": "*"
}
},
"@types/uuid": {
"version": "3.4.7",
"resolved": "https://verdaccio.lossless.one/@types%2fuuid/-/uuid-3.4.7.tgz",
"integrity": "sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ=="
},
"@types/which": {
"version": "1.3.2",
"resolved": "https://verdaccio.lossless.one/@types%2fwhich/-/which-1.3.2.tgz",
@ -1237,6 +1259,11 @@
"resolved": "https://verdaccio.lossless.one/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"nanoid": {
"version": "2.1.11",
"resolved": "https://verdaccio.lossless.one/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://verdaccio.lossless.one/nice-try/-/nice-try-1.0.5.tgz",
@ -1454,9 +1481,9 @@
"dev": true
},
"resolve": {
"version": "1.15.0",
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.15.0.tgz",
"integrity": "sha512-+hTmAldEGE80U2wJJDC1lebb5jWqvTYAfm3YZ1ckk1gBr0MnCqUKlwK1e+anaFljIl+F5tR5IoZcm4ZDA1zMQw==",
"version": "1.15.1",
"resolved": "https://verdaccio.lossless.one/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true,
"requires": {
"path-parse": "^1.0.6"
@ -1517,6 +1544,14 @@
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=",
"dev": true
},
"shortid": {
"version": "2.2.15",
"resolved": "https://verdaccio.lossless.one/shortid/-/shortid-2.2.15.tgz",
"integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==",
"requires": {
"nanoid": "^2.1.0"
}
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://verdaccio.lossless.one/signal-exit/-/signal-exit-3.0.2.tgz",
@ -1640,9 +1675,9 @@
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
},
"tslint": {
"version": "5.20.1",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"version": "6.0.0",
"resolved": "https://verdaccio.lossless.one/tslint/-/tslint-6.0.0.tgz",
"integrity": "sha512-9nLya8GBtlFmmFMW7oXXwoXS1NkrccqTqAtwXzdPV9e2mqSEvCki6iHL/Fbzi5oqbugshzgGPk7KBb2qNP1DSA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@ -1656,7 +1691,7 @@
"mkdirp": "^0.5.1",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tslib": "^1.10.0",
"tsutils": "^2.29.0"
}
},
@ -1702,6 +1737,11 @@
"resolved": "https://verdaccio.lossless.one/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"uuid": {
"version": "3.4.0",
"resolved": "https://verdaccio.lossless.one/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
},
"wcwidth": {
"version": "1.0.1",
"resolved": "https://verdaccio.lossless.one/wcwidth/-/wcwidth-1.0.1.tgz",

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/levelcache",
"version": "1.0.2",
"version": "1.0.6",
"private": false,
"description": "a cache that uses memory/disk/s3 as backup",
"main": "dist/index.js",
@ -16,16 +16,17 @@
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.11.7",
"tslint": "^5.11.0",
"@types/node": "^13.7.1",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/lik": "^3.0.13",
"@pushrocks/lik": "^3.0.18",
"@pushrocks/smartbucket": "^1.0.24",
"@pushrocks/smartcache": "^1.0.13",
"@pushrocks/smartfile": "^7.0.6",
"@pushrocks/smartstring": "^3.0.18"
"@pushrocks/smartfile": "^7.0.8",
"@pushrocks/smartstring": "^3.0.18",
"@pushrocks/smartunique": "^3.0.1"
},
"files": [
"ts/**/*",

View File

@ -1,8 +1,17 @@
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 () => {
testLevelCache.
});
tap.start();

View File

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

View File

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

View File

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

View File

@ -1 +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

@ -0,0 +1,21 @@
import * as plugins from './levelcache.plugins';
import { LevelCache } from './levelcache.classes.levelcache';
export class CacheRouter {
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

@ -1,14 +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';
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.Stringmap();
public cacheRouter = new CacheRouter(this);
public cacheDiskManager = new CacheDiskManager();
public cacheMemoryManager = new CacheMemoryManager();
public cacheS3Manager = new CacheS3Manager();
public async storeBlob () {}
public options: ILevelCacheConstructorOptions;
public async retrieveBlob () {}
constructor(optionsArg: ILevelCacheConstructorOptions) {
this.options = optionsArg;
}
private processKey(keyArg: string) {
if (!keyArg) {
return plugins.smartunique.shortId();
}
}
// Blobs
/**
* store a Blob
*/
public async storeBlobByKey(keyArg: string, blob: Buffer) {
keyArg = this.processKey(keyArg);
return keyArg;
}
/**
* retrieve a blob
*/
public async retrieveBlob(keyArg: string): CacheEntry {}
// Cache Entries
/**
* retrieve cache entry
*/
public async retrieveCacheEntryByKey(): CacheEntry {}
/**
* cleans the cache
*/
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';
@ -11,11 +9,6 @@ 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
};
export { lik, smartbucket, smartcache, smartfile, smartstring, smartunique };