https://github.com/nikhilcodes/amnesia-js
NodeJS client for AmnesiaDB
https://github.com/nikhilcodes/amnesia-js
Last synced: 8 months ago
JSON representation
NodeJS client for AmnesiaDB
- Host: GitHub
- URL: https://github.com/nikhilcodes/amnesia-js
- Owner: NikhilCodes
- License: agpl-3.0
- Created: 2021-09-15T14:17:24.000Z (about 4 years ago)
- Default Branch: stable
- Last Pushed: 2021-09-17T20:09:57.000Z (about 4 years ago)
- Last Synced: 2025-03-17T19:59:40.941Z (9 months ago)
- Language: TypeScript
- Homepage:
- Size: 60.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Amnesia JS
[AmnesiaDB](https://github.com/NikhilCodes/AmnesiaDB) Official Client
## Example
Connect to locally hosted Amnesia DB
```javascript
import { AmnesiaClient } from 'amnesia-client';
const am = new AmnesiaClient();
await am.connect({ port: 4224 });
```
Run a Query
```javascript
let res = await am.query('SET a AS b WHERE TTL=10s NFETCH=2');
console.log(res) // OK
```
Alternatively
```javascript
let res = await am.get('key'); // null
await am.set('key', 'value', { ttl: '20s', nfetch: 2 });
let res = await am.get('key'); // value
```