Several restrictions on the use of memcached

Source: Internet
Author: User
Memcached has several important restrictions, especially the expiration time restrictions. Otherwise, it is easy to step on the mine: www.2cto. com1) size limit of a single cache value: the size limit of a single memcached cache value is 1 MB (1000000 bytes )... memcached has several important restrictions, especially the expiration time restrictions. Otherwise, it is easy to step on the mines: www.2cto.com 1) size limit of a single cache value: the size limit of a single memcached cache value is 1 MB (1000000 bytes). If this limit is exceeded, the following error occurs: ValueError: values may not be more than 1000000 bytes in length; received 2000000 bytes 2) key length limit: memcache's keys limit is 250 bytes, exceeding this length The following error occurs: ValueError: Keys may not be more than 250 bytes in length, received 14670 bytes www.2cto.com 3) expire Expiration Time limit: There are two ways to set the Expiration Time: 1. you can use the unix timestamp format, that is, the time offset (in seconds) from 00:00:00. 2. the time interval (in seconds) from the current time) it cannot be greater than 2592000 (30 days) from the time interval of the current time. if the time value is greater than 2592000, memcached interprets the time as the unix timestamp format, that is, the offset of the number of seconds from 1970.01.01. 0 indicates that it never expires. Pay special attention to this issue. when we set a time interval greater than 2592000, for example, 2592010, the written data will be considered as a unix timestamp format, and the data has expired after it is written, this is equivalent to preventing data from being written. worse, the memcached server and the client driver will not throw an exception or print any warning information, for memcached, such a time value is also reasonable. P.S. the limit of this expire may seem to be reflected after memcached 1.2.6. this phenomenon was not observed in previous versions such as 1.2.1.
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.