Contents
  1. 1. Redis 是什麼?
  2. 2. 安裝 redis server, redis-py
  3. 3. 設定並啟動 redis server
  4. 4. minimal test

Redis 是什麼?

redis 是 key:value pair’s cache system, 或是說是一套 distributed dictionary server
從 StackOverflow 的問題 Memcached vs. Redis? 大家一面倒地推 Redis

安裝 redis server, redis-py

1
2
brew install redis
pip install redis

設定並啟動 redis server

1
2
3
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
redis-server /usr/local/etc/redis.conf

測試看看 redis 是否跑起來

1
redis-cli ping

minimal test

1
2
3
4
5
6
import redis
r = redis.Redis(host='localhost', port=6379, db=0)
r.set('foo','bar')
True
r.get('foo')
bar
Contents
  1. 1. Redis 是什麼?
  2. 2. 安裝 redis server, redis-py
  3. 3. 設定並啟動 redis server
  4. 4. minimal test