keyv 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -2
- package/package.json +5 -5
- package/src/index.js +25 -19
- package/.npmignore +0 -77
- package/.travis.yml +0 -21
- package/media/logo.svg +0 -10
- package/test/keyv.js +0 -84
- package/test/storage-adapters/mongodb.js +0 -9
- package/test/storage-adapters/mysql.js +0 -9
- package/test/storage-adapters/postgresql.js +0 -9
- package/test/storage-adapters/redis.js +0 -9
- package/test/storage-adapters/sqlite.js +0 -9
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://travis-ci.org/lukechilds/keyv)
|
|
10
10
|
[](https://coveralls.io/github/lukechilds/keyv?branch=master)
|
|
11
|
+
[](https://www.npmjs.com/package/keyv)
|
|
11
12
|
[](https://www.npmjs.com/package/keyv)
|
|
12
13
|
|
|
13
14
|
Keyv provides a consistent interface for key-value storage across multiple backends via storage adapters. It supports TTL based expiry, making it suitable as a cache or a persistent key-value store.
|
|
@@ -21,7 +22,7 @@ There are a few existing modules similar to Keyv, however Keyv is different beca
|
|
|
21
22
|
- Suitable as a TTL based cache or persistent key-value store
|
|
22
23
|
- [Easily embeddable](#add-cache-support-to-your-module) inside another module
|
|
23
24
|
- Works with any storage that implements the [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) API
|
|
24
|
-
- Handles all
|
|
25
|
+
- Handles all JSON types plus `Buffer`
|
|
25
26
|
- Supports namespaces
|
|
26
27
|
- Wide range of [**efficient, well tested**](#official-storage-adapters) storage adapters
|
|
27
28
|
- Connection errors are passed through (db failures won't kill your app)
|
|
@@ -59,7 +60,7 @@ const keyv = new Keyv('postgresql://user:pass@localhost:5432/dbname');
|
|
|
59
60
|
const keyv = new Keyv('mysql://user:pass@localhost:3306/dbname');
|
|
60
61
|
|
|
61
62
|
// Handle DB connection errors
|
|
62
|
-
keyv.on('error' err => console.log('Connection Error', err));
|
|
63
|
+
keyv.on('error', err => console.log('Connection Error', err));
|
|
63
64
|
|
|
64
65
|
await keyv.set('foo', 'expires in 1 second', 1000); // true
|
|
65
66
|
await keyv.set('foo', 'never expires'); // true
|
|
@@ -85,6 +86,18 @@ await users.get('foo'); // undefined
|
|
|
85
86
|
await cache.get('foo'); // 'cache'
|
|
86
87
|
```
|
|
87
88
|
|
|
89
|
+
### Custom Serializers
|
|
90
|
+
|
|
91
|
+
Keyv uses [`json-buffer`](https://github.com/dominictarr/json-buffer) for data serialization to ensure consistency across different backends.
|
|
92
|
+
|
|
93
|
+
You can optionally provide your own serialization functions to support extra data types or to serialize to something other than JSON.
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
const keyv = new Keyv({ serialize: JSON.stringify, deserialize: JSON.parse });
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Warning:** Using custom serializers means you lose any guarantee of data consistency. You should do extensive testing with your serialisation functions and chosen storage engine.
|
|
100
|
+
|
|
88
101
|
## Official Storage Adapters
|
|
89
102
|
|
|
90
103
|
The official storage adapters are covered by [over 150 integration tests](https://travis-ci.org/lukechilds/keyv/jobs/260418145) to guarantee consistent behaviour. They are lightweight, efficient wrappers over the DB clients making use of indexes and native TTLs where available.
|
|
@@ -124,6 +137,12 @@ const lru = new QuickLRU({ maxSize: 1000 });
|
|
|
124
137
|
const keyv = new Keyv({ store: lru });
|
|
125
138
|
```
|
|
126
139
|
|
|
140
|
+
The following are third-party storage adapters compatible with Keyv:
|
|
141
|
+
|
|
142
|
+
- [quick-lru](https://github.com/sindresorhus/quick-lru) - Simple "Least Recently Used" (LRU) cache
|
|
143
|
+
- [keyv-file](https://github.com/zaaack/keyv-file) - File system storage adapter for Keyv
|
|
144
|
+
- [keyv-dynamodb](https://www.npmjs.com/package/keyv-dynamodb) - DynamoDB storage adapter for Keyv
|
|
145
|
+
|
|
127
146
|
## Add Cache Support to your Module
|
|
128
147
|
|
|
129
148
|
Keyv is designed to be easily embedded into other modules to add cache support. The recommended pattern is to expose a `cache` option in your modules options which is passed through to Keyv. Caching will work in memory by default and users have the option to also install a Keyv storage adapter and pass in a connection string, or any other storage that implements the `Map` API.
|
|
@@ -196,6 +215,20 @@ Default: `undefined`
|
|
|
196
215
|
|
|
197
216
|
Default TTL. Can be overridden by specififying a TTL on `.set()`.
|
|
198
217
|
|
|
218
|
+
#### options.serialize
|
|
219
|
+
|
|
220
|
+
Type: `Function`<br>
|
|
221
|
+
Default: `JSONB.stringify`
|
|
222
|
+
|
|
223
|
+
A custom serialization function.
|
|
224
|
+
|
|
225
|
+
#### options.deserialize
|
|
226
|
+
|
|
227
|
+
Type: `Function`<br>
|
|
228
|
+
Default: `JSONB.parse`
|
|
229
|
+
|
|
230
|
+
A custom deserialization function.
|
|
231
|
+
|
|
199
232
|
#### options.store
|
|
200
233
|
|
|
201
234
|
Type: `Storage adapter instance`<br>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keyv",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Simple key-value storage with support for multiple backends",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"json-buffer": "3.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"ava": "^0.
|
|
36
|
-
"coveralls": "^
|
|
35
|
+
"ava": "^0.25.0",
|
|
36
|
+
"coveralls": "^3.0.0",
|
|
37
37
|
"eslint-config-xo-lukechilds": "^1.0.0",
|
|
38
38
|
"@keyv/mongo": "*",
|
|
39
39
|
"@keyv/mysql": "*",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@keyv/test-suite": "*",
|
|
44
44
|
"nyc": "^11.0.3",
|
|
45
45
|
"this": "^1.0.2",
|
|
46
|
-
"timekeeper": "^
|
|
47
|
-
"xo": "^0.
|
|
46
|
+
"timekeeper": "^2.0.0",
|
|
47
|
+
"xo": "^0.20.1"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/index.js
CHANGED
|
@@ -24,7 +24,11 @@ class Keyv extends EventEmitter {
|
|
|
24
24
|
constructor(uri, opts) {
|
|
25
25
|
super();
|
|
26
26
|
this.opts = Object.assign(
|
|
27
|
-
{
|
|
27
|
+
{
|
|
28
|
+
namespace: 'keyv',
|
|
29
|
+
serialize: JSONB.stringify,
|
|
30
|
+
deserialize: JSONB.parse
|
|
31
|
+
},
|
|
28
32
|
(typeof uri === 'string') ? { uri } : uri,
|
|
29
33
|
opts
|
|
30
34
|
);
|
|
@@ -48,17 +52,19 @@ class Keyv extends EventEmitter {
|
|
|
48
52
|
get(key) {
|
|
49
53
|
key = this._getKeyPrefix(key);
|
|
50
54
|
const store = this.opts.store;
|
|
51
|
-
return Promise.resolve(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
return Promise.resolve()
|
|
56
|
+
.then(() => store.get(key))
|
|
57
|
+
.then(data => {
|
|
58
|
+
data = (typeof data === 'string') ? this.opts.deserialize(data) : data;
|
|
59
|
+
if (data === undefined) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
if (typeof data.expires === 'number' && Date.now() > data.expires) {
|
|
63
|
+
this.delete(key);
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return data.value;
|
|
67
|
+
});
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
set(key, value, ttl) {
|
|
@@ -73,11 +79,9 @@ class Keyv extends EventEmitter {
|
|
|
73
79
|
|
|
74
80
|
return Promise.resolve()
|
|
75
81
|
.then(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
return store.set(key, JSONB.stringify(value), ttl);
|
|
82
|
+
const expires = (typeof ttl === 'number') ? (Date.now() + ttl) : null;
|
|
83
|
+
value = { value, expires };
|
|
84
|
+
return store.set(key, this.opts.serialize(value), ttl);
|
|
81
85
|
})
|
|
82
86
|
.then(() => true);
|
|
83
87
|
}
|
|
@@ -85,12 +89,14 @@ class Keyv extends EventEmitter {
|
|
|
85
89
|
delete(key) {
|
|
86
90
|
key = this._getKeyPrefix(key);
|
|
87
91
|
const store = this.opts.store;
|
|
88
|
-
return Promise.resolve(
|
|
92
|
+
return Promise.resolve()
|
|
93
|
+
.then(() => store.delete(key));
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
clear() {
|
|
92
97
|
const store = this.opts.store;
|
|
93
|
-
return Promise.resolve(
|
|
98
|
+
return Promise.resolve()
|
|
99
|
+
.then(() => store.clear());
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
|
package/.npmignore
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
test/testdb.sqlite
|
|
2
|
-
|
|
3
|
-
## Node
|
|
4
|
-
|
|
5
|
-
#npm5
|
|
6
|
-
package-lock.json
|
|
7
|
-
|
|
8
|
-
# Logs
|
|
9
|
-
logs
|
|
10
|
-
*.log
|
|
11
|
-
npm-debug.log*
|
|
12
|
-
|
|
13
|
-
# Runtime data
|
|
14
|
-
pids
|
|
15
|
-
*.pid
|
|
16
|
-
*.seed
|
|
17
|
-
*.pid.lock
|
|
18
|
-
|
|
19
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
20
|
-
lib-cov
|
|
21
|
-
|
|
22
|
-
# Coverage directory used by tools like istanbul
|
|
23
|
-
coverage
|
|
24
|
-
|
|
25
|
-
# nyc test coverage
|
|
26
|
-
.nyc_output
|
|
27
|
-
|
|
28
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
29
|
-
.grunt
|
|
30
|
-
|
|
31
|
-
# node-waf configuration
|
|
32
|
-
.lock-wscript
|
|
33
|
-
|
|
34
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
35
|
-
build/Release
|
|
36
|
-
|
|
37
|
-
# Dependency directories
|
|
38
|
-
node_modules
|
|
39
|
-
jspm_packages
|
|
40
|
-
|
|
41
|
-
# Optional npm cache directory
|
|
42
|
-
.npm
|
|
43
|
-
|
|
44
|
-
# Optional eslint cache
|
|
45
|
-
.eslintcache
|
|
46
|
-
|
|
47
|
-
# Optional REPL history
|
|
48
|
-
.node_repl_history
|
|
49
|
-
|
|
50
|
-
## OS X
|
|
51
|
-
|
|
52
|
-
*.DS_Store
|
|
53
|
-
.AppleDouble
|
|
54
|
-
.LSOverride
|
|
55
|
-
|
|
56
|
-
# Icon must end with two \r
|
|
57
|
-
Icon
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# Thumbnails
|
|
61
|
-
._*
|
|
62
|
-
|
|
63
|
-
# Files that might appear in the root of a volume
|
|
64
|
-
.DocumentRevisions-V100
|
|
65
|
-
.fseventsd
|
|
66
|
-
.Spotlight-V100
|
|
67
|
-
.TemporaryItems
|
|
68
|
-
.Trashes
|
|
69
|
-
.VolumeIcon.icns
|
|
70
|
-
.com.apple.timemachine.donotpresent
|
|
71
|
-
|
|
72
|
-
# Directories potentially created on remote AFP share
|
|
73
|
-
.AppleDB
|
|
74
|
-
.AppleDesktop
|
|
75
|
-
Network Trash Folder
|
|
76
|
-
Temporary Items
|
|
77
|
-
.apdisk
|
package/.travis.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
dist: trusty
|
|
2
|
-
language: node_js
|
|
3
|
-
node_js:
|
|
4
|
-
- '8'
|
|
5
|
-
- '6'
|
|
6
|
-
- '4'
|
|
7
|
-
services:
|
|
8
|
-
- redis-server
|
|
9
|
-
- mongodb
|
|
10
|
-
- mysql
|
|
11
|
-
addons:
|
|
12
|
-
postgresql: '9.5'
|
|
13
|
-
before_script:
|
|
14
|
-
- psql -c 'create database keyv_test;' -U postgres
|
|
15
|
-
- mysql -u root -e 'CREATE DATABASE keyv_test;'
|
|
16
|
-
- mysql -u root -e 'GRANT ALL PRIVILEGES ON keyv_test.* TO 'mysql'@'localhost';'
|
|
17
|
-
script: npm run test:full
|
|
18
|
-
after_success: npm run coverage
|
|
19
|
-
notifications:
|
|
20
|
-
email:
|
|
21
|
-
on_success: never
|
package/media/logo.svg
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
-
<svg width="512" height="512" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<defs>
|
|
4
|
-
<linearGradient x1="30%" y1="20%" x2="65%" y2="50%" id="gradient">
|
|
5
|
-
<stop stop-color="#24C6DC" offset="0%"></stop>
|
|
6
|
-
<stop stop-color="#C86DD7" offset="100%"></stop>
|
|
7
|
-
</linearGradient>
|
|
8
|
-
</defs>
|
|
9
|
-
<path fill="url(#gradient)" fill-rule="nonzero" d="M189 196v-17.4c13.7 10.2 40.2 15 66.5 15 26.3 0 52.8-4.8 66.5-15V196c0 12-30 21.8-66.5 21.8-36.6 0-66.5-9.8-66.5-21.8zm133 16.6v19.8c-3.7 11-32.3 19.4-66.5 19.4s-62.8-8.5-66.5-19.4v-20c13.7 10.4 40.2 15 66.5 15 26.3 0 52.8-4.6 66.5-14.8zM189 162v-17.4c13.7 10.2 40.2 15 66.5 15 26.3 0 52.8-4.8 66.5-15V162c0 12-30 22-66.5 22-36.6 0-66.5-10-66.5-22zm66.5-12c-36.7 0-66.5-10-66.5-22s29.8-21.8 66.5-21.8S322 116 322 128s-29.8 22-66.5 22zm.5 362C114.6 512 0 397.4 0 256S114.6 0 256 0s256 114.6 256 256-114.6 256-256 256zm0-3c139.7 0 253-113.3 253-253S395.6 3 256 3 3 116.4 3 256s113.3 253 253 253zM122 351.2l56-51h5l-56.5 51 59.3 60h-5l-58.7-59.7v59.8h-3.5v-111h3.4v51zm77 23.3c0 4.4.7 8.7 2 13 1.3 4.3 3.3 8 6 11.5 2.6 3.5 6 6.3 10 8.4 4 2 9 3 14.5 3 5.7 0 10.7-1 15-3.3 4.5-2 8.3-5.4 11.5-9.7l2.5 2.2c-3.5 4.6-7.7 8-12.4 10.5-4.7 2.4-10.2 3.6-16.5 3.6-5.3 0-10.2-1-14.6-3-4.5-1.8-8.3-4.5-11.5-8-3.2-3.4-5.6-7.5-7.4-12.3-1.6-5-2.5-10-2.5-15.7 0-5.5 1-10.5 2.7-15 1.8-4.7 4.2-8.7 7.3-12 3-3.4 6.7-6 11-7.8 4-2 8.6-2.8 13.4-2.8 5.6 0 10.5 1 14.7 3 4.2 2 7.7 4.6 10.4 8 3 3 5 6.8 6.3 11 1.4 4 2 8.3 2 12.6v3H199zm61-3c0-4.7-.8-9-2.4-13-1.5-3.8-3.5-7-6.2-10-2.6-2.6-5.7-4.8-9.4-6.3-3.6-1.5-7.7-2.3-12.2-2.3-5.5 0-10 1-14 3.4-4 2.2-7 5-9.5 8.3-2.5 3.3-4.3 6.8-5.4 10.4-1.3 3.7-1.8 7-1.8 9.6h61zm40.7 63.7c-1.6 4.5-4 8-6.6 10.5-2.7 2.4-6.3 3.6-10.7 3.6-1 0-2 0-3.3-.3-1.2 0-2.3-.3-3-.7l.8-3c.6.3 1.5.5 2.6.7 1 .2 2.2.3 3.2.3 2.2 0 4-.4 5.8-1.3 1.6-.8 3-2 4-3.2 1.3-1.3 2.2-2.8 3-4.4.8-1.7 1.5-3.4 2-5l7-19-28.5-74.2h3.6l26.6 70.4 25.6-70.4h3.7l-35.8 96zm76.3-24h-4.5l-28.4-72h3.8l27 68.7h.2l26-68.8h3.7L377 411.4z"></path>
|
|
10
|
-
</svg>
|
package/test/keyv.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import tk from 'timekeeper';
|
|
3
|
-
import keyvTestSuite from '@keyv/test-suite';
|
|
4
|
-
import Keyv from 'this';
|
|
5
|
-
|
|
6
|
-
test.serial('Keyv is a class', t => {
|
|
7
|
-
t.is(typeof Keyv, 'function');
|
|
8
|
-
t.throws(() => Keyv()); // eslint-disable-line new-cap
|
|
9
|
-
t.notThrows(() => new Keyv());
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test.serial('Keyv accepts storage adapters', async t => {
|
|
13
|
-
const store = new Map();
|
|
14
|
-
const keyv = new Keyv({ store });
|
|
15
|
-
t.is(store.size, 0);
|
|
16
|
-
await keyv.set('foo', 'bar');
|
|
17
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
18
|
-
t.is(store.size, 1);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test.serial('Keyv hands tll functionality over to ttl supporting stores', async t => {
|
|
22
|
-
t.plan(3);
|
|
23
|
-
const store = new Map();
|
|
24
|
-
store.ttlSupport = true;
|
|
25
|
-
const storeSet = store.set;
|
|
26
|
-
store.set = (key, val, ttl) => {
|
|
27
|
-
t.is(ttl, 100);
|
|
28
|
-
storeSet.call(store, key, val, ttl);
|
|
29
|
-
};
|
|
30
|
-
const keyv = new Keyv({ store });
|
|
31
|
-
await keyv.set('foo', 'bar', 100);
|
|
32
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
33
|
-
tk.freeze(Date.now() + 150);
|
|
34
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
35
|
-
tk.reset();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
test.serial('Keyv respects default tll option', async t => {
|
|
39
|
-
const store = new Map();
|
|
40
|
-
const keyv = new Keyv({ store, ttl: 100 });
|
|
41
|
-
await keyv.set('foo', 'bar');
|
|
42
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
43
|
-
tk.freeze(Date.now() + 150);
|
|
44
|
-
t.is(await keyv.get('foo'), undefined);
|
|
45
|
-
tk.reset();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test.serial('.set(key, val, ttl) overwrites default tll option', async t => {
|
|
49
|
-
const startTime = Date.now();
|
|
50
|
-
tk.freeze(startTime);
|
|
51
|
-
const store = new Map();
|
|
52
|
-
const keyv = new Keyv({ store, ttl: 200 });
|
|
53
|
-
await keyv.set('foo', 'bar');
|
|
54
|
-
await keyv.set('fizz', 'buzz', 100);
|
|
55
|
-
await keyv.set('ping', 'pong', 300);
|
|
56
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
57
|
-
t.is(await keyv.get('fizz'), 'buzz');
|
|
58
|
-
t.is(await keyv.get('ping'), 'pong');
|
|
59
|
-
tk.freeze(startTime + 150);
|
|
60
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
61
|
-
t.is(await keyv.get('fizz'), undefined);
|
|
62
|
-
t.is(await keyv.get('ping'), 'pong');
|
|
63
|
-
tk.freeze(startTime + 250);
|
|
64
|
-
t.is(await keyv.get('foo'), undefined);
|
|
65
|
-
t.is(await keyv.get('ping'), 'pong');
|
|
66
|
-
tk.freeze(startTime + 350);
|
|
67
|
-
t.is(await keyv.get('ping'), undefined);
|
|
68
|
-
tk.reset();
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test.serial('.set(key, val, ttl) where ttl is "0" overwrites default tll option and sets key to never expire', async t => {
|
|
72
|
-
const startTime = Date.now();
|
|
73
|
-
tk.freeze(startTime);
|
|
74
|
-
const store = new Map();
|
|
75
|
-
const keyv = new Keyv({ store, ttl: 200 });
|
|
76
|
-
await keyv.set('foo', 'bar', 0);
|
|
77
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
78
|
-
tk.freeze(startTime + 250);
|
|
79
|
-
t.is(await keyv.get('foo'), 'bar');
|
|
80
|
-
tk.reset();
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const store = () => new Map();
|
|
84
|
-
keyvTestSuite(test, Keyv, store);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import keyvTestSuite, { keyvOfficialTests } from '@keyv/test-suite';
|
|
3
|
-
import Keyv from 'this';
|
|
4
|
-
import KeyvMongo from '@keyv/mongo';
|
|
5
|
-
|
|
6
|
-
keyvOfficialTests(test, Keyv, 'mongodb://127.0.0.1:27017', 'mongodb://127.0.0.1:1234');
|
|
7
|
-
|
|
8
|
-
const store = () => new KeyvMongo('mongodb://127.0.0.1:27017');
|
|
9
|
-
keyvTestSuite(test, Keyv, store);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import keyvTestSuite, { keyvOfficialTests } from '@keyv/test-suite';
|
|
3
|
-
import Keyv from 'this';
|
|
4
|
-
import KeyvMysql from '@keyv/mysql';
|
|
5
|
-
|
|
6
|
-
keyvOfficialTests(test, Keyv, 'mysql://mysql@localhost/keyv_test', 'mysql://foo');
|
|
7
|
-
|
|
8
|
-
const store = () => new KeyvMysql('mysql://mysql@localhost/keyv_test');
|
|
9
|
-
keyvTestSuite(test, Keyv, store);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import keyvTestSuite, { keyvOfficialTests } from '@keyv/test-suite';
|
|
3
|
-
import Keyv from 'this';
|
|
4
|
-
import KeyvPostgres from '@keyv/postgres';
|
|
5
|
-
|
|
6
|
-
keyvOfficialTests(test, Keyv, 'postgresql://postgres@localhost:5432/keyv_test', 'postgresql://foo');
|
|
7
|
-
|
|
8
|
-
const store = () => new KeyvPostgres('postgresql://postgres@localhost:5432/keyv_test');
|
|
9
|
-
keyvTestSuite(test, Keyv, store);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import keyvTestSuite, { keyvOfficialTests } from '@keyv/test-suite';
|
|
3
|
-
import Keyv from 'this';
|
|
4
|
-
import KeyvRedis from '@keyv/redis';
|
|
5
|
-
|
|
6
|
-
keyvOfficialTests(test, Keyv, 'redis://localhost', 'redis://foo');
|
|
7
|
-
|
|
8
|
-
const store = () => new KeyvRedis('redis://localhost');
|
|
9
|
-
keyvTestSuite(test, Keyv, store);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import test from 'ava';
|
|
2
|
-
import keyvTestSuite, { keyvOfficialTests } from '@keyv/test-suite';
|
|
3
|
-
import Keyv from 'this';
|
|
4
|
-
import KeyvSqlite from '@keyv/sqlite';
|
|
5
|
-
|
|
6
|
-
keyvOfficialTests(test, Keyv, 'sqlite://test/testdb.sqlite', 'sqlite://non/existent/database.sqlite');
|
|
7
|
-
|
|
8
|
-
const store = () => new KeyvSqlite('sqlite://test/testdb.sqlite');
|
|
9
|
-
keyvTestSuite(test, Keyv, store);
|