1.14. Memcached incr and decr commands

发布时间 : 2025-10-25 13:33:42 UTC      

Page Views: 9 views

Memcached incr and decr command is used for existing key the numeric value of (key) is used for self-increasing or self-decreasing operation.

incr and decr the data for the command operation must be a decimal 32-bit unsigned integer.

If key has no return NOT_FOUND , the value of the key is nota number, returns CLIENT_ERROR other errors are returned ERROR .

1.14.1. incr command

Syntax:

The incr basic syntax format of the command is as follows:

incr key increment_value 

The parameters are described as follows:

  • key :Key value key-value in the structure key used to find cached values

  • increment_value :The increased number.

1.14.2. Example

In the following example, we use the visitors as key the initial value is 10, and then add 5.

set visitors 0 900 2 10 STORED get visitors VALUE visitors 0 2 10 END incr visitors 5 15 get visitors VALUE visitors 0 2 15 END 

1.14.3. Output

Output information description:

  • NOT_FOUND : key doesn’t exist.

  • CLIENT_ERROR :Self-increment is not an object.

  • ERROR other errors, such as grammatical errors.

1.14.4. decr command

The decr basic syntax format of the command is as follows:

decr key decrement_value 

The parameters are described as follows:

  • key :Key value key-value in the structure key used to find cached values

  • decrement_value :The reduced number.

Example

set visitors 0 900 2 10 STORED get visitors VALUE visitors 0 2 10 END decr visitors 5 5 get visitors VALUE visitors 0 1 5 END 

In the following example, we use the visitors as key with an initial value of 10, followed by minus 5

1.14.5. Output

Output information description:

  • NOT_FOUND : key doesn’t exist.

  • CLIENT_ERROR :Self-increment is not an object.

  • ERROR other errors, such as grammatical errors.

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。