memcached key,value, Expiration time limit

Source: Internet
Author: User
Tags control characters memcached

1. What is the maximum length of the key value ?

The maximum length of the memcached key is more than one character and is the limit of the memcached server.

If you are using a client that supports "key prefixes" or similar features, then the maximum length of key (prefix + original key) can be more than 250 characters.

We recommend using shorter keys because you can save memory and bandwidth. Key as long as not repeating on the line, if too big waste memory.

To modify the key size:

Modify the memcached source file. Define the length of the key in memcached.h with the following code:

#define Key_max_length 250

2.key cannot have spaces and control characters

The key must not include control characters or whitespace.

3. For Item the expiration time limit ?

The expiration time is maximum .

If you do not pay attention to this detail, the Expiration time setting is greater than 30 days, the value will not be set into the cache

4. How large a single can be stored item?

1MB, because this is the maximum value of a typical slab .

If your data is larger than 1MB, consider compressing or splitting the client into multiple keys.

Can be modified with the-l option:

-L OVERRIDE the size of each slab page. Adjusts max item size. (DEFAULT:1MB, min:1k, max:128m)

To add, you can start by adding the-I 10m parameter.

There will be a warning:

Warning:setting Item Max size above 1MB is not recommended!
Raising this limit increases the minimum memory requirements
And would decrease your memory efficiency.

memcached key,value, Expiration time limit

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.