RedisList

play.api.cache.redis.RedisList
trait RedisList[Elem, Result[_]]

Redis Lists are simply lists of strings, sorted by insertion order. It is possible to add elements to a Redis List pushing new elements on the head (on the left) or on the tail (on the right) of the list.

Type parameters

Elem

Data type of the inserted element

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Type members

Classlikes

Attributes

Supertypes
class Object
trait Matchable
class Any

Attributes

Supertypes
class Object
trait Matchable
class Any

Types

override type This = RedisList[Elem, Result]

Value members

Abstract methods

def ++:(elements: Iterable[Elem]): Result[This]

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.

Value parameters

elements

element to be prepended

Attributes

Returns

this collection to chain commands

def +:(element: Elem): Result[This]

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.

Value parameters

element

element to be prepended

Attributes

Returns

this collection to chain commands

def :+(element: Elem): Result[This]

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Value parameters

element

to be apended

Attributes

Returns

this collection to chain commands

def :++(elements: Iterable[Elem]): Result[This]

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Value parameters

elements

to be apended

Attributes

Returns

this collection to chain commands

def append(element: Elem): Result[This]

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Insert all the specified values at the tail of the list stored at key. If key does not exist, it is created as empty list before performing the push operation. When key holds a value that is not a list, an error is returned. * It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the tail of the list, from the leftmost element to the rightmost element. So for instance the command RPUSH mylist a b c will result into a list containing a as first element, b as second element and c as third element.

Value parameters

element

to be apended

Attributes

Returns

this collection to chain commands

def apply(index: Long): Result[Elem]

Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth. When the value at key is not a list, an error is returned.

Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth. When the value at key is not a list, an error is returned.

Time complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1).

Value parameters

index

position of the element

Attributes

Returns

element at the index or exception

def get(index: Long): Result[Option[Elem]]

Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth. When the value at key is not a list, an error is returned.

Returns the element at index index in the list stored at key. The index is zero-based, so 0 means the first element, 1 the second element and so on. Negative indices can be used to designate elements starting at the tail of the list. Here, -1 means the last element, -2 means the penultimate and so forth. When the value at key is not a list, an error is returned.

Time complexity: O(N) where N is the number of elements to traverse to get to the element at index. This makes asking for the first or the last element of the list O(1).

Value parameters

index

position of the element

Attributes

Returns

Some( element ) at the index, None if no element exists, or exception when the value is not a list

def headPop: Result[Option[Elem]]

Removes and returns the first element of the list stored at key.

Removes and returns the first element of the list stored at key.

Time complexity: O(1)

Attributes

Returns

head element if exists

def insertBefore(pivot: Elem, element: Elem): Result[Option[Long]]

Inserts value in the list stored at key either before the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed. An error is returned when key exists but does not hold a list value.

Inserts value in the list stored at key either before the reference value pivot. When key does not exist, it is considered an empty list and no operation is performed. An error is returned when key exists but does not hold a list value.

Time complexity: O(N) where N is the number of elements to traverse before seeing the value pivot. This means that inserting somewhere on the left end on the list (head) can be considered O(1) and inserting somewhere on the right end (tail) is O(N).

Value parameters

element

elements to be inserted

pivot

insert before this value

Attributes

Returns

new size of the collection or None if pivot not found

Attributes

Returns

write-only operations over the collection, modify data

def prepend(element: Elem): Result[This]

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

Insert all the specified values at the head of the list stored at key. If key does not exist, it is created as empty list before performing the push operations. When key holds a value that is not a list, an error is returned.

It is possible to push multiple elements using a single command call just specifying multiple arguments at the end of the command. Elements are inserted one after the other to the head of the list, from the leftmost element to the rightmost element. So for instance the command LPUSH mylist a b c will result into a list containing c as first element, b as second element and a as third element.

Value parameters

element

element to be prepended

Attributes

Returns

this collection to chain commands

def remove(element: Elem, count: Long): Result[This]

Removes first N values equal to the given value from the list.

Removes first N values equal to the given value from the list.

Note: If the value is serialized object, it is not proofed that serialized strings will match and the value will be actually deleted. This function is intended to be used with primitive types only.

Time complexity: O(N)

Value parameters

count

first N occurrences

element

element to be removed from the list

Attributes

Returns

this collection to chain commands

def removeAt(position: Long): Result[This]

Removes the element at the given position. If the index is out of range, it throws an exception.

Removes the element at the given position. If the index is out of range, it throws an exception.

Time complexity: O(N)

Value parameters

position

element index to be removed

Attributes

Returns

this collection to chain commands

def set(position: Long, element: Elem): Result[This]

Sets the list element at index to value. For more information on the index argument, see LINDEX. An error is returned for out of range indexes.

Sets the list element at index to value. For more information on the index argument, see LINDEX. An error is returned for out of range indexes.

Value parameters

element

elements to be inserted

position

position to insert at

Attributes

Returns

this collection to chain commands

Attributes

Returns

read-only operations over the collection, does not modify data

Concrete methods

def head: Result[Elem]

Attributes

Returns

first element of the collection or an exception

def headOption: Result[Option[Elem]]

Attributes

Returns

first element of the collection or None

def last: Result[Elem]

Attributes

Returns

last element of the collection or an exception

def lastOption: Result[Option[Elem]]

Attributes

Returns

last element of the collection or None

def toList: Result[Seq[Elem]]

Attributes

Returns

Helper to this.view.all returning all object in the list

Inherited methods

def isEmpty: Result[Boolean]

Attributes

Inherited from:
RedisCollection (hidden)
def nonEmpty: Result[Boolean]

Attributes

Inherited from:
RedisCollection (hidden)
def size: Result[Long]

Returns the length of the collection stored at key. If key does not exist, it is interpreted as an empty collection and 0 is returned. An error is returned when the value stored at key is not a proper collection.

Returns the length of the collection stored at key. If key does not exist, it is interpreted as an empty collection and 0 is returned. An error is returned when the value stored at key is not a proper collection.

Time complexity: O(1)

Attributes

Returns

size of the list

Inherited from:
RedisCollection (hidden)