Redis as Cache

Source: Internet
Author: User

Cache policy three elements: Cache Hit rate cache update policy maximum cache capacity. The standard for measuring a cache scenario is: Cache Hit ratio. The higher the cache hit rate, the better the caching method is designed.

The relationship between the three is: when the cache reaches the maximum cache capacity, the cache update policy is triggered, and the cache update policy affects the cache hit ratio. As you can see, caching scenarios depend on the maximum number of settings in the cache and the selection of cache update policies.

For frequently changing data, it is not suitable for caching. For static, read-write high (generally more than 10:1) of the data cache.

The common cache update policies are:

1 FIFO queue, first-in, FIFO, typical application: MySQL's query cache, using this simple cache update strategy

2 LFU: Minimum use, with counter implementation

3 LRU: Not used for the longest time, with counters and queues

For Redis, when MaxMemory is reached, there are five options to choose from, depending on the scenario, which strategy removes the key:

volatile-lru 采用LRU算法删除带有expire的key(默认)allkeys-lru  采用LRU算法删除任意keyvolatile-random 任意删除带有expire的keyallkeys-random  删除任意keyvolatile-ttl 删除最接近expire的keynoeviction  不删除,直接对写命令返回错误

Redis as Cache

Related Article

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.