Hello I am newbie to Redis. I am trying to use Redis as my primary database instead of sqlite as provided by default with Rails. I tried enough googling but could not find relevant stuff. How to achieve this? Or if iam wrong whether can we use Redis as primary database in Rails application?
Thanks
Typically you'd use a library like https://github.com/nateware/redis-objects. As its README says, it's not just another way to store ActiveRecords, since you may as well keep it simple and use MySQL or Postgres if all you want is ActiveRecords. Instead, redis-object will let you use Redis data structures as they are intended to be used.
This is not an ORM. People that are wrapping ORM’s around Redis are missing the point.
The killer feature of Redis is that it allows you to perform atomic operations on individual data structures, like counters, lists, and sets. The atomic part is HUGE. Using an ORM wrapper that retrieves a "record", updates values, then sends those values back, removes the atomicity, cutting the nuts off the major advantage of Redis. Just use MySQL, k?
You can also just install the Redis gem and make your own calls to Redis, but that kind of low-level programming would largely defeat the purpose of using a powerful framework like Rails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With