module RedisModel::Types::List
Internal: Methods needed for List
type.
Public Instance Methods
<<(value)
click to toggle source
Public: Pushes a element into the list using RPUSH command.
Returns true.
# File lib/redis_model/types/list.rb, line 33 def <<(value) connection.rpush key_label, value end
Also aliased as: push
[](index)
click to toggle source
Public: Retrieves a element in the list using LINDEX command.
Returns String
containing value of the specified element.
# File lib/redis_model/types/list.rb, line 26 def [](index) connection.lindex key_label, index end
count()
click to toggle source
Public: Retrieves length of Redis list using LLEN command.
Returns Integer
containing length of the list.
# File lib/redis_model/types/list.rb, line 17 def count connection.llen key_label end
Also aliased as: length
to_a()
click to toggle source
Public: Fetches elements in Redis list as Array using LRANGE command.
Returns Array containing elements in the list.
# File lib/redis_model/types/list.rb, line 10 def to_a connection.lrange key_label, 0, -1 end