@glidepro/store
v3.0.7
Published
- `npm i @glidepro/store --save`
Downloads
35
Readme
Install
npm i @glidepro/store --save
Setup
Add or amend your environment file to include:
STORE_AWS_SECRET_ACCESS_KEY
STORE_AWS_ACCESS_KEY_ID
STORE_AWS_S3_BUCKET
AWS
The library requires permissions to use the following S3 commands:
GetObject
PutObject
DeleteObject
Usage
All commands return a Promise.
const { set, get, hset, hgetall } = require("@glidepro/store");
const test = async () => {
await set("test:string", "this is a string!");
await hset("test:hash", { field: "of cows" });
console.log(await get("test:string")); // this is a string!
console.log(await hgetall("test:hash")); // { field: 'of cows' }
};
test();
Supported commands
Generic
exists
del
ttl
expire
persist
Hash
hdel
hgetall
hkeys
hvals
hlen
hincrby
hincrbyfloat
hset
hsetnx
hrandfield
hget
hmget
hexists
hstrlen
Set
sadd
srem
scard
sismember
smembers
String
get
set
Differences
Note this is not an exhaustive list, yet.
- hashes are stored as whole JSON objects, e.g.
HSET key value
allowsvalue
to be an array, object, number, string or boolean and it will be stored in that format rather than being forced to string or being required to stringify prior to issuing the command.