ARLASTITEMS

ARLASTITEMS key count [REV]
Available since:
Redis Open Source 8.8.0
Time complexity:
O(N) where N is the count
ACL categories:
ARRAY,

Returns the most recently inserted elements.

Required arguments

key

The name of the key that holds the array.

count

The maximum number of most recently inserted elements to return. If the array contains fewer elements than count, all elements are returned.

Optional arguments

REV

When present, returns elements in reverse chronological order (most recent first) instead of the default oldest-first order.

Examples

ARINSERT log "first" ARINSERT log "second" ARINSERT log "third" ARLASTITEMS log 2 ARLASTITEMS log 2 REV

Return information

RATE THIS PAGE
Back to top ↑