Is the schema set in stone?
the lowest hanging fruits are:
1. use one user id. hash it if you don't want sequential ids to be
visible, but that already saves a lot of complexity and one call.
2. save the departmentId and companyId inside a HASH for the user
itself, not as separate HASH objects. that way you can use HMGET to
get all the user's properties.
apart from the guid->id query at the beginning, and the uniqueness
dependent HSET, the rest can be pipelined. and the whole thing can be
written as one lua function of course.
provided you implement 1 and 2, the code can look like:
pipeline.hmget(userId, "department", "company")
pipeline.hsetnx("some", "thing", "0")
properties, isUnique = pipeline.execute()
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To post to this group, send email to
redi...@googlegroups.com.
> To unsubscribe from this group, send email to
>
redis-db+u...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/redis-db?hl=en.
--
Dvir Volk
Chief Architect, Everything.me
http://everything.me