- redis-server
- redis-server config/redis.conf
- redis-cli -h localhost -p 6379
- set test "Hello World"
- get test
- exists test -> 1
- append test "add more hello world" -> get test
- keys * -> list all keys
- key test* -> list all keys that start with test
- del test (delete key) -> get test -> (nil)
- set test "Hello World"
- get test -> setrange test 6 "Redis" -> get test
- mset key1 "Hello" key2 "World" key3 "Redis"
- mget key1 key2 key3
- expire key 10 (seconds)
- setex key 10 "Hello" (set key and expiration)
- ttl key (time to live)
- incr key
- decr key
- get key
- incrby key [value]
- decrby key [value]
- get key
- flushdb (delete all keys in current database)
- flushall (delete all keys in all databases)
- redis-cli -h host -p port -n database --pipe < input-file (redis-cli -h localhost -p 6379 -n 0 --pipe < input-file.txt)
- multi (start transaction)
- exec (execute transaction)
- discard (cancel transaction)
- config get * -> list all configurations
- config get *max* -> list all configurations that contains max
- config get maxmemory -> get maxmemory configuration
- config get databases
- config get bind
- config get save
- redis-cli -h 192.168.1.101 -p 6379