diff --git a/.npmignore b/.npmignore index 544a7a1..da3414c 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,4 @@ tests -README.md .travis.yml CODE_OF_CONDUCT.md CONTRIBUTING.md @@ -8,4 +7,6 @@ CONTRIBUTING.md package-lock.json *.clinic* sample.txt -.github \ No newline at end of file +.github +logo.png +yarn.lock \ No newline at end of file diff --git a/README.md b/README.md index ec8bb30..c63e607 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@

+ HA-store +
High-Availability store

diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..562e6cc Binary files /dev/null and b/logo.png differ diff --git a/package.json b/package.json index 5c55d7a..e21027a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ha-store", - "version": "3.1.1", + "version": "3.2.0", "description": "Efficient data fetching", "main": "src/index.js", "scripts": { @@ -36,11 +36,11 @@ "license": "Apache-2.0", "devDependencies": { "chai": "^4.3.0", - "eslint": "^7.29.0", + "eslint": "^8.18.0", "ha-store-redis": "^2.0.1", - "mocha": "^9.0.0", - "sinon": "^11.1.0", - "split2": "^3.2.0" + "mocha": "^10.0.0", + "sinon": "^14.0.0", + "split2": "^4.1.0" }, "contributors": [ "frederic charette ", @@ -49,6 +49,6 @@ ], "typings": "./src/index.d.ts", "dependencies": { - "lru-cache": "^6.0.0" + "lru-cache": "^7.10.0" } } diff --git a/src/index.js b/src/index.js index cdb8326..8959279 100644 --- a/src/index.js +++ b/src/index.js @@ -19,10 +19,6 @@ class HaStore extends EventEmitter { this.config = hydrateConfig(initialConfig); - if (this.setMaxListeners) { - this.setMaxListeners(Infinity); - } - this.store = this.config.cache ? this.config.store(this.config) : null; this.storeGetMulti = (key, ids) => this.store.getMulti(contextRecordKey(key), ids); this.storeGet = (key, id) => ([ this.store.get(recordKey(key, id)) ]); diff --git a/src/store.js b/src/store.js index 4d323b0..bc6d564 100644 --- a/src/store.js +++ b/src/store.js @@ -5,7 +5,7 @@ const lru = require('lru-cache'); function localStore(config) { const store = new lru({ max: config.cache.limit, - maxAge: config.cache.ttl, + ttl: config.cache.ttl, }); function get(key) { @@ -30,14 +30,14 @@ function localStore(config) { function clear(key) { if (key === '*') { - store.reset(); + store.clear(); return true; } - return store.del(key); + return store.delete(key); } function size() { - return store.itemCount; + return store.size; } return { get, getMulti, set, clear, size };