window平台下的redis dll文件下载:https://github.com/char101/phpredis/downloads
Redis 根据 5 种不同的数据类型来操作数据对象:
String(字符串)
Sets(集合)
zsets( 排序后的sets集合)
List(列表)
hash(哈稀)
操作 String 类型的值:
Command | Parameters | Description |
---|---|---|
SET | key value | Set a key to a string value |
GET | key | Return the string value of the key |
GETSET | key value | Set a key to a string returning the old value of the key |
MGET | key1 key2 … keyN | Multi-get, return the strings values of the keys |
SETNX | key | value Set a key to a string value if the key does not exist |
SETEX | key time value | Set+Expire combo command |
MSET | key1 value1 key2 value2 … keyN valueN | Set multiple keys to multiple values in a single atomic operation |
MSETNX | key1 value1 key2 value2 … keyN valueN | Set multiple keys to multiple values in a single atomic operation if none of the keys already exist |
INCR | key | Increment the integer value of key |
INCRBY | key | integer Increment the integer value of key by integer |
DECR | key | Decrement the integer value of key |
DECRBY | key | integer Decrement the integer value of key by integer |
APPEND | key value | Append the specified string to the string stored at key |
SUBSTR | key start end | Return a substring of a larger string |