The official Redis KeyValue connector for LoopBack.
loopbackio / loopback-connector-kv-redis Goto Github PK
View Code? Open in Web Editor NEWThe official Redis KeyValue connector for LoopBack.
License: Other
The official Redis KeyValue connector for LoopBack.
License: Other
Already implemented in kv-memory connectors. The redis connector implementation is simple,
basically copy the get method, and replace 'get' with 'del'.
Most LoopBack connectors allow users to provide a single setting called "url" that overrides any other settings like "host" and "port". This is used to override datasource configuration via environmental variables, for example.
I found the code in /lib/kv-redis.js, only provide set, get
command, but i need some more command, such as hset,hget etc. how can i figure it out?
Add the ability to watch keys for changes. I think its ok if we add this support for only this connector, unless there is enough overlap in other data sources.
Useful for test cleanup to clear out all keys associated to a model. Already implemented in kv-memory and kv-extreme-scale connectors. The redis connector implementation will be a bit more complicated since we "compose" the model names with the keys, so we should only be deleting all keys related to an associated model.
Leaving this as a tech debt item that we should implement at some point to unify the the API since redis supports flushall/flushdb
oeprations OOB. See loopbackio/loopback-datasource-juggler#1206.
The key expiration time is not set by the expire method.
Error: key not generated or unable to set expiry time.
Sometimes if I use expire method after set method, even key is also getting generated.
Even after I applied the suggestion from https://github.com/strongloop/loopback-connector-kv-redis/pull/3/files/83d233188ee29e12515003d61ac878312d806596#r74969814, pr-builder still does not pick the tests for me :(
http://ci.strongloop.com/job/loopback-connector-kv-redis/node=0.10,os=amazon/74/console
[sl-ci-run INFO 30.58 ]: Running tests...
[sl-ci-run INFO 30.58 ]: command: /mnt/tmp/tmp5072442244938479074dirbfr/node_modules/build-framework/node_modules/.bin/istanbul cover --print none /mnt/jenkins/workspace/loopback-connector-kv-redis/0fde463e/node_modules/mocha/bin/_mocha -- --reporter /mnt/tmp/tmp5072442244938479074dirbfr/node_modules/build-framework/node_modules/mocha-jenkins-reporter
[sl-ci-run INFO 30.62 ]: env: JUNIT_REPORT_PATH=xunit.xml JUNIT_REPORT_STACK=1 PATH=/mnt/jenkins/workspace/loopback-connector-kv-redis/0fde463e/node_modules/.bin:/mnt/tmp/tmp5072442244938479074dirbfr/node_modules/build-framework/node_modules/.bin:/opt/node-0.10/bin:/usr/local/bin:/bin:/usr/bin:/opt/aws/bin NODE_ENV=test LD_LIBRARY_PATH=/mnt/jenkins/workspace/loopback-connector-kv-redis/0fde463e/node_modules/instantclient DEBUG=
0 passing (1ms)
No coverage information was collected, exit without writing coverage information
[sl-ci-run INFO 33.79 ]: Tests passed.
@rmg
cc @superkhau
This repo needs a useful README. See http://loopback.io/doc/en/contrib/README-guidelines.html for general guidelines.
I have a redis server that has 'requirepass' enabled. I set a password when creating the redis kv repository using the lb4 datasource command, however I get the error:
[ioredis] Unhandled error event: ReplyError: NOAUTH Authentication required.
My redis.datasource.config.json file looks like this:
{
"name": "redis",
"connector": "kv-redis",
"url": "<myHost",
"host": "",
"port": 6379,
"password": "",
"db": 0
}
darwin x64 10.15.3
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── [email protected]
I defined datasource for redis like this
{
"host": "127.0.0.1",
"port": 6379,
"name": "xrjti-token-redis",
"connector": "kv-redis"
}
when I tried to run npm start
, it crashed
/xr-jti-api/node_modules/loopback-datasource-juggler/lib/datasource.js:542
modelClass[relation.type].call(modelClass, relationName, params);
let kvSampleModel = app.models.kvSample;
return linkModel.iterateKeys({}, {}).next()
.then(result => {
});
https://github.com/strongloop/loopback-connector-kv-redis/blob/master/lib/kv-redis.js#L296
I don't understand why shift the cache array.
I think this should be like cache.forEach(value => {...
get all the keys of the kvSampleModel.
get one key.
Support of lock to stop concurrency with finance domain application.
Whenever a where statement returns 0 results, the app crashes.
/project/node_modules/strong-globalize/lib/helper.js:739
matched = (name.indexOf(header) === 0);
^
TypeError: name.indexOf is not a function
at /project/node_modules/strong-globalize/lib/helper.js:739:23
at Array.forEach (native)
at headerIncluded (/project/node_modules/strong-globalize/lib/helper.js:737:20)
at Object.hashKeys (/project/node_modules/strong-globalize/lib/helper.js:110:12)
at formatMessage (/project/node_modules/strong-globalize/lib/globalize.js:96:14)
at packMessage (/project/node_modules/strong-globalize/lib/globalize.js:201:17)
at Object.rfc5424 (/project/node_modules/strong-globalize/lib/globalize.js:224:10)
at StrongGlobalize.log (/project/node_modules/strong-globalize/index.js:185:20)
at RedisClient.<anonymous> (/project/node_modules/loopback-connector-redis/lib/redis.js:56:7)
at emitOne (events.js:96:13)
at RedisClient.emit (events.js:188:7)
at RedisClient.on_data (/project/node_modules/redis/index.js:553:14)
at Socket.<anonymous> (/project/node_modules/redis/index.js:102:14)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:548:20)
using either id, or any other kind of where statement, if the result has no entries, it crashes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.