HaNdTriX
HaNdTriX

Reputation: 29786

sails-redis: increment attributes values

I'd like to use sails-redis to track all kinds of events.

Therefore I need the ability to increment model attributes in a performant way.

I already found the Model.native function, wich allows me to access the native redis methods.

But since sails-redis is based on Strings and not on Hashes I can not use any native increment methods (so far i know).

Is there any clean and performant way to solve this issue?

Upvotes: 1

Views: 717

Answers (1)

HaNdTriX
HaNdTriX

Reputation: 29786

The thing sails-redis does is to create a database with CRUD methods by using redis key-value-store based on strings.

Therefore do not see sails-redis as an wrapper for redis. Forget about that. It is just another database which almost has nothing to do with redis.

Use the right tool for the right job!

I you have a job like event tracking where you want to use Redis because of it's speed use node-redis and implement it yourself. sails-redis is just not made for such things.

I simply created a new service and used node-redis. There might be a more elegant way, but mines works and improved performance a hole lot.

https://github.com/balderdashy/sails-redis/issues/34

Upvotes: 1

Related Questions