Skip to main content

Overview

Inserts one or more values at the head of the list stored at key. If key does not exist, it is created as an empty list before performing the push operations.

Method Signature

Parameters

string
required
The key of the list.
TData[]
required
One or more elements to insert at the head of the list. Elements are inserted one after the other, so the first element in the arguments will be the first element of the list.

Return Value

number
The length of the list after the push operations.

Examples

Basic Usage

Working with Objects

Building a Queue

See Also

  • RPUSH - Insert elements at the tail of a list
  • LPOP - Remove and return the first element of a list
  • LRANGE - Get a range of elements from a list
  • LLEN - Get the length of a list