UNPKG

2.4 kBJavaScriptView Raw
1/*
2
3 ----------------------------------------------------------------------------
4 | qewd: Quick and Easy Web Development |
5 | |
6 | Copyright (c) 2017 M/Gateway Developments Ltd, |
7 | Reigate, Surrey UK. |
8 | All rights reserved. |
9 | |
10 | http://www.mgateway.com |
11 | Email: rtweed@mgateway.com |
12 | |
13 | |
14 | Licensed under the Apache License, Version 2.0 (the "License"); |
15 | you may not use this file except in compliance with the License. |
16 | You may obtain a copy of the License at |
17 | |
18 | http://www.apache.org/licenses/LICENSE-2.0 |
19 | |
20 | Unless required by applicable law or agreed to in writing, software |
21 | distributed under the License is distributed on an "AS IS" BASIS, |
22 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
23 | See the License for the specific language governing permissions and |
24 | limitations under the License. |
25 ----------------------------------------------------------------------------
26
27 3 January 2017
28
29*/
30
31var interface = require('cache');
32var db = new interface.Cache();
33console.log('db: ' + JSON.stringify(db));
34
35// Change these parameters to match your GlobalsDB or Cache system:
36
37var ok = db.open({
38 path: '/opt/cache/mgr',
39 username: '_SYSTEM',
40 password: 'SYS',
41 namespace: 'USER'
42});
43
44
45console.log('ok: ' + JSON.stringify(ok));
46
47console.log(db.version());
48
49var node = {
50 global: 'rob',
51 subscripts: [1],
52 data: 'hello'
53};
54
55db.set(node);
56
57var result = db.get(node);
58console.log(JSON.stringify(result));
59
60db.close();