Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7672995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:24:40+00:00 2026-05-31T16:24:40+00:00

Suppose you have a LIST datatype in Redis. How do you delete all its

  • 0

Suppose you have a LIST datatype in Redis. How do you delete all its entries? I’ve tried this already:

LTRIM key 0 0
LTRIM key -1 0

Both of those leave the first element. This will leave all the elements:

LTRIM key 0 -1

I don’t see a separate command to completely empty a list.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T16:24:41+00:00Added an answer on May 31, 2026 at 4:24 pm

    Delete the key, and that will clear all items. Not having the list at all is similar to not having any items in it. Redis will not throw any exceptions when you try to access a non-existent key.

    DEL key
    

    Here’s some console logs.

    redis> KEYS *
    (empty list or set)
    redis> LPUSH names John
    (integer) 1
    redis> LPUSH names Mary
    (integer) 2
    redis> LPUSH names Alice
    (integer) 3
    redis> LLEN names
    (integer) 3
    redis> LRANGE names 0 2
    1) "Alice"
    2) "Mary"
    3) "John"
    redis> DEL names
    (integer) 1
    redis> LLEN names
    (integer) 0
    redis> LRANGE names 0 2
    (empty list or set)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a list of lists of elements which are all the same
Suppose I have this list: thelist = ['apple','orange','banana','grapes'] for fruit in thelist: This would
Suppose I have this list: [ [5, 44, 73] , [7, 21, 99], [1,
Suppose I have ten list item, in that case I can use both div
Suppose you have a list of MyObject like this: public class MyObject { public
Suppose you have list 1 (ilist1) and list 2 (ilist2) both lists have 3
Suppose I have one list: IList<int> originalList = new List<int>(); originalList.add(1); originalList.add(5); originalList.add(10); And
Suppose I have a list, in which no new nodes are added or deleted.
Suppose I have a list (or Set): List<String> testList = Lists.newArrayList(assocX,srcT,destA,srcX, don't care Y,
Suppose I have a list X = [a, b, c] where a, b, c

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.