LRU and MRU concepts

Source: Internet
Author: User

1. cache hit and cache miss

When a user sends a data query request to the database for the first time, the database first searches for the data in the buffer zone. If the data to be accessed happens to be in the buffer zone (we call it cache hit) then read the data directly using the buffer.

Otherwise, if there is no user data in the buffer, this is called cache miss. In this case, the database will first read the user's data from the disk and put it into the buffer, the user then reads the data from the buffer.

Obviously, cache hit is faster than cache miss.

 

2. LRU (Least recently used algorithms) And MRU (Most recently used algorithms)

The basic concept of the so-called LRU (least recently used) algorithm is: when there is not enough available space in the memory, the buffer zone tries its best to retain the data most commonly used by users, in other words, the system preferentially clears "infrequently used data" and releases its space. the reason why "infrequently used data" should be enclosed in quotation marks is that the so-called seldom used standards are artificial and not strict. the so-called MRU (most recently used) algorithm has the opposite significance as the LRU algorithm.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.