Giter VIP home page Giter VIP logo

loopback-connector-kv-redis's Introduction

loopback-connector-kv-redis

The official Redis KeyValue connector for LoopBack.

loopback-connector-kv-redis's People

Contributors

0candy avatar agnes512 avatar bajtos avatar candytangnb avatar chrisw-ibm avatar dhmlau avatar emonddr avatar kallenboone avatar mrbatista avatar nabdelgadir avatar raymondfeng avatar siddhipai avatar simonhoibm avatar superkhau avatar yosimasu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loopback-connector-kv-redis's Issues

Support "url" connection string in settings

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.

how can i use command 'HSET'?

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?

WATCH

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.

@bajtos

Add flush operation

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.

expire() method not working

Description/Steps to reproduce

The key expiration time is not set by the expire method.

  1. Create new redis key with set(key,data) method.
  2. Try to set expiry time for the key by using expire(key,ttl).

Error: key not generated or unable to set expiry time.

Additional information

Sometimes if I use expire method after set method, even key is also getting generated.

pr-builder not picking up mocha tests

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

Password not working

Steps to reproduce

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]

Crash on npm start

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);

image

iterateKeys just return one key

Bug or feature request

  • Bug
  • Feature request

Description of feature (or steps to reproduce if bug)

    let kvSampleModel = app.models.kvSample;
    return linkModel.iterateKeys({}, {}).next()
        .then(result => {
        });

Link to sample repo to reproduce issue (if bug)

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 => {...

Expected result

get all the keys of the kvSampleModel.

Actual result (if bug)

get one key.

Additional information (Node.js version, LoopBack version, etc)

Lock Support

Support of lock to stop concurrency with finance domain application.

Crash when no result

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.