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 7035441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:18:17+00:00 2026-05-28T01:18:17+00:00

Does someone know about the internals of Redis LRU based eviction / deletion. How

  • 0

Does someone know about the internals of Redis LRU based eviction / deletion.

How does Redis ensure that the older (lesser used) keys are deleted first (in case we do not have volatile keys and we are not setting TTL expiration)?

I know for sure that Redis has a configuration parameter “maxmemory-samples” that governs a sample size that it uses for removing keys – so if you set a sample size of 10 then it samples 10 keys and removes the oldest from amongst these.

What I don’t know is whether it sample these key’s completely randomly, or does it somehow have a mechanism that allows it to automatically sample from an equivalent of an “older / less used generation”?

  • 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-28T01:18:17+00:00Added an answer on May 28, 2026 at 1:18 am

    This is what I found at antirez.com/post/redis-as-LRU-cache.html – the whole point of using a “sample three” algorithm is to save memory. I think this is much more valuable than precision, especially since this randomized algorithms are rarely well understood. An example: sampling with just three objects will expire 666 objects out of a dataset of 999 with an error rate of only 14% compared to the perfect LRU algorithm. And in the 14% of the remaining there are hardly elements that are in the range of very used elements. So the memory gain will pay for the precision without doubts.

    So although Redis samples randomly (implying that this is not actual LRU .. and as such an approximation algorithm), the accuracy is relatively high and increasing the sampling size will further increase this. However, in case someone needs exact LRU (there is zero tolerance for error), then Redis may not be the correct choice.

    Architecture … as they say … is about tradeoffs .. so use this (Redis LRU) approach to tradeoff accuracy for raw performance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does someone know of a Sqlite manager that I can put on my site,
Does someone know how to setup ELIM in emacs? There is no information about
does someone know something about TV output with dock connector. I would like to
Does someone know why there is a margin (about 1px) around the button background-image,
does someone know how to draw 3D surfaces and hide the invisible lines? I
Does someone know or have an idea of how to reload the contents of
Does someone know why this is not a strict quine ? _0='_0=%r;print _0%%_0';print _0%_0
Does someone know how to write a program in C with the verbose option
In jQuery ajax function there is xhr option. Does someone know more details, usability
This StackOverflow answer has an image of KDiff3 highlighting intra-line differences. Does someone know

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.