Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Creating ordered lists

19 views
Skip to first unread message

Jose Ernesto Suarez

unread,
Oct 24, 2015, 7:22:24 AM10/24/15
to Ohm Ruby
Hi!

I´m a bit confusing about creating ordered lists, but the docs show me the same way for creating ordered and unordered lists

... 
set :stocks, :Symbol
list: quotations, :Symbol

self.stocks.add, <<,  and self.quotations.add, push,  seems the same because where is the order field?

I want to create an ordered list

zadd "NASDAQ.YHOO" Time.no.utc.to_i symbol:id

This is an ordered Yahoo quotations ordered by a timestamp, but the timestamp could be replaced to another interesting time. I want to store a symbol reference at least.

What is the Ohm way to work with this data model?

Michel Martens

unread,
Oct 24, 2015, 7:38:41 AM10/24/15
to ohm-...@googlegroups.com
Hello José,

Those two types correspond to the list and set types in Redis. What
you are looking for are sorted sets, which are available via third
party tools.

Here are two you can try:

https://github.com/educabilia/ohm-sorted
https://github.com/joshualat/ohm-zset

Eventually, this behavior will be incorporated into Ohm itself.

Let me know how it goes!
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ohm Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ohm-ruby+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jose Ernesto Suarez

unread,
Oct 24, 2015, 12:00:19 PM10/24/15
to Ohm Ruby
Hi Michael!

Thanks! Seems exactly what I want, I want to try all two because sorted has a nice partitioning feature but zset is more accurate that I was looking for.

Let´s try!

Jose Ernesto Suarez

unread,
Oct 24, 2015, 1:28:02 PM10/24/15
to Ohm Ruby
Ohm/sorted seems to be outdated, as I can read https://github.com/educabilia/ohm-sorted/issues/4 doesn´t support the 2.x branch of Ohm and when I try to import:

.rvm/gems/ruby-2.1.1/gems/ohm-sorted-0.4.1/lib/ohm/sorted.rb:106:in `<module:Ohm>': uninitialized constant Ohm::Model::Collection (NameError)


It´s a pitty!

Michel Martens

unread,
Oct 24, 2015, 1:34:17 PM10/24/15
to ohm-...@googlegroups.com
If the other solution doesn't work, let me know and I'll write one for you.

On Sat, Oct 24, 2015 at 5:28 PM, Jose Ernesto Suarez

scalp42

unread,
Sep 22, 2016, 2:59:21 AM9/22/16
to Ohm Ruby
Hi Michael,

Do you know if there's any chance to see sorted sets supported in Ohm directly? It appears that both solutions are for an older version unfortunately.

Thanks a lot for the reply!
Reply all
Reply to author
Forward
0 new messages