Compare commits
4 Commits
fs-cache-f
...
master
Author | SHA1 | Date |
---|---|---|
Jonatan Nilsson | 3304dee531 | |
Jonatan Nilsson | 3f559bb9f5 | |
Jonatan Nilsson | 1d7a61f688 | |
Jonatan Nilsson | 56af3613a2 |
|
@ -2,6 +2,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- meme
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default class FSCache {
|
||||||
this.fsPromises = fsPromises || fsPromisesOriginal
|
this.fsPromises = fsPromises || fsPromisesOriginal
|
||||||
|
|
||||||
this.id = crypto.randomBytes(15).toString('base64').replace(/\//g, '-')
|
this.id = crypto.randomBytes(15).toString('base64').replace(/\//g, '-')
|
||||||
this.prefix = options.prefix ? options.prefix + '-' : '-'
|
this.prefix = (options.ns || options.prefix || '') + '-'
|
||||||
this.hash_alg = options.hash_alg || 'md5'
|
this.hash_alg = options.hash_alg || 'md5'
|
||||||
this.cache_dir = options.cache_dir || path.join(os.tmpdir(), this.id)
|
this.cache_dir = options.cache_dir || path.join(os.tmpdir(), this.id)
|
||||||
this.ttl = options.ttl || 0
|
this.ttl = options.ttl || 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "fs-cache-fast",
|
"name": "fs-cache-fast",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"description": "Cache stored on the file system",
|
"description": "Cache stored on the file system",
|
||||||
"main": "index.mjs",
|
"main": "index.mjs",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -61,6 +61,16 @@ t.describe('#constructor()', function() {
|
||||||
assert.strictEqual(cache.ttl, assertTtl)
|
assert.strictEqual(cache.ttl, assertTtl)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
t.test('supports alternative way of specifying prefix', function() {
|
||||||
|
const assertPrefix = 'blablabutmore'
|
||||||
|
|
||||||
|
let cache = createCache({
|
||||||
|
ns: assertPrefix,
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.strictEqual(cache.prefix, assertPrefix + '-')
|
||||||
|
})
|
||||||
|
|
||||||
t.test('should create the directory by default', function() {
|
t.test('should create the directory by default', function() {
|
||||||
assert.notOk(fsSync.mkdirSync.called)
|
assert.notOk(fsSync.mkdirSync.called)
|
||||||
let cache = createCache({})
|
let cache = createCache({})
|
||||||
|
|
Loading…
Reference in New Issue