Redis in Action

Redis in Action

Redis

Redis in Action_第1张图片

REmote DIctionary Server(Redis)

Redis 是一种开放源代码(BSD许可)的内存中数据结构存储,用作数据库,缓存和消息代理。

它支持数据结构,例如字符串,哈希,列表,集合,带范围查询的排序集,位图,超级日志,带有半径查询和流的地理空间索引。

#  redis-server  version

$ redis-server -v
$ redis-server --version

# redis-6.0.6

#  redis-client  version
$ redis-cli -v

# If you want to know the version of the server, from the client
> INFO

https://stackoverflow.com/questions/22153504/how-to-find-out-redis-version

https://stackoverflow.com/questions/21555942/how-to-check-redis-instance-version

Redis in Action_第2张图片

https://redis.io/

https://redis.io/commands

https://redis.io/clients

REPL

http://try.redis.io/

$ HELP
# Please type HELP for one of these commands: DECR, DECRBY, DEL, EXISTS, EXPIRE, GET, GETSET, HDEL, HEXISTS, HGET, HGETALL, HINCRBY, HKEYS, HLEN, HMGET, HMSET, HSET, HVALS, INCR, INCRBY, KEYS, LINDEX, LLEN, LPOP, LPUSH, LRANGE, LREM, LSET, LTRIM, MGET, MSET, MSETNX, MULTI, PEXPIRE, RENAME, RENAMENX, RPOP, RPOPLPUSH, RPUSH, SADD, SCARD, SDIFF, SDIFFSTORE, SET, SETEX, SETNX, SINTER, SINTERSTORE, SISMEMBER, SMEMBERS, SMOVE, SORT, SPOP, SRANDMEMBER, SREM, SUNION, SUNIONSTORE, TTL, TYPE, ZADD, ZCARD, ZCOUNT, ZINCRBY, ZRANGE, ZRANGEBYSCORE, ZRANK, ZREM, ZREMRANGEBYSCORE, ZREVRANGE, ZSCORE


$ help SET
# OR
$ help set

"""
SET key value
TIME COMPLEXITY: O(1)

DESCRIPTION: Set key to hold the string value. If key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on successful SET operation.

Options
EX seconds -- Set the specified expire time, in seconds.
PX milliseconds -- Set the specified expire time, in milliseconds.
NX -- Only set the key if it does not already exist.
XX -- Only set the key if it already exist.
RETURN VALUE: Status code reply: OK if SET was executed correctly. Null multi-bulk reply: a Null Bulk Reply is returned if the SET operation was not performed because the user specified the NX or XX option but the condition was not met.
"""
# use the command SET to store the value "fido" at key "server:name":
SET server:name "fido"
# OK

# use the command GET to read the value stored at key server:name
GET server:name
# "fido"

# test if a give key exists(1) or not(0)

EXISTS server:name
# (integer) 1
EXISTS server:blabla
# (integer) 0

docs

https://redis.io/documentation

http://doc.redisfans.com/

数据结构

  String: 字符串
  Hash: 散列
  List: 列表
  Set: 集合
  Sorted Set: 有序集合
  bitmaps
  hyperloglogs
  geospatial indexes

Ctrl + ⬇

切换 vscode workspace

refs

http://download.redis.io/releases/redis-6.0.6.tar.gz


Redis in Action_第3张图片

©xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


你可能感兴趣的:(Redis in Action)