1

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?

HaNdTriX
  • 28,732
  • 11
  • 78
  • 85

1 Answers1

1

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

HaNdTriX
  • 28,732
  • 11
  • 78
  • 85
  • I know the comment comes late for the thread, but I encountered the same kind of 'problem' now and I'm also thinking of abandoning sails-redis in favor of a wrapper service over node-redis. Considering this why should one use sails-redis at all? If it creates a classic no sql database on top of redis and you lose the performance bonus isn't it better to go with something like mongo and sails-mongo? – Vee6 May 04 '15 at 08:02