soveran / ohm

Object-Hash Mapping for Redis
http://ohm.keyvalue.org
MIT License
1.4k stars 167 forks source link

Redis Cluster support #213

Open ababich opened 8 years ago

ababich commented 8 years ago

Hello! Is there any Redis Cluster support planned or tried? First of all I mean proper group operations handling via corresponding key(s) composition and preventing incorrect attempts

May be you have some posts with having this tried/tested with Ohm or some plans about this?

Thanks!

soveran commented 7 years ago

Hello @ababich, there are no plans for Redis Cluster support but it's something we could investigate in the future. At first sight it looks like a tough problem. We could embed key tags to make sure all the keys end up in the same node, but that kind of defeats the purpose of using Redis Cluster.

ababich commented 7 years ago

To my understanding only index-related keys should be touched Also, LUA scripts should provide support for save actions

soveran commented 7 years ago

I have an idea that may work. I'll get back to you tomorrow after testing it a bit.

soveran commented 7 years ago

@ababich I've tried Ohm with Redis Cluster and it works after adding key tags. There's a branch called namespace with code that you can try, but you can also check the code online and make the changes by hand as there's nothing fancy going on. The idea is to change the name of a model, so that all keys generated include a given key tag. You can read more in the documentation for Ohm::Namespace and you can check the tests. Let me know if it works for you and maybe we can ship it.

ababich commented 7 years ago

I think it is more important to tag "relation", not model I will scan all multi-keys operations for possible issues