6 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
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 159 additions and 27 deletions

68
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/levelcache",
"version": "1.0.2",
"version": "1.0.5",
"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.16",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.16.tgz",
"integrity": "sha512-rvF4aJL6IRDZXNtSHwnkT+iXUj4peY928g7xpJh8hrFxABMbE89nH/fOBQ0m36IuI5dZBvbZv++2qiFOLsL+oA==",
"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"
@ -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.0",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-13.7.0.tgz",
"integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
},
"@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.5",
"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.0",
"tslint": "^6.0.0",
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/lik": "^3.0.13",
"@pushrocks/lik": "^3.0.16",
"@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,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';
/**
* a leveled cache for storing things for a short time
*/
export class LevelCache {
public cacheMap = new plugins.lik.Stringmap();
public cacheMap = new plugins.lik.Objectmap();
public cacheDiskManager = new CacheDiskManager();
public cacheMemoryManager = new CacheMemoryManager();
public cacheS3Manager = new CacheS3Manager();
public async storeBlob () {}
private processKey (keyArg: string) {
if (!keyArg) {
return plugins.smartunique.shortId();
}
}
public async retrieveBlob () {}
// Blobs
/**
* store a Blob
*/
public async storeBlobByKey (keyArg: string, blob: Buffer) {
keyArg = this.processKey(keyArg);
return keyArg;
}
public clean() {}
/**
* retrieve a blob
*/
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 {
}
/**
* 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
};