Browse Source

Update 'README.md'

天问 1 month ago
parent
commit
db3051d3d4
1 changed files with 27 additions and 0 deletions
  1. 27 0
      README.md

+ 27 - 0
README.md

@@ -1,2 +1,29 @@
 # redis
 
+## Usage
+
+1. first install dep:
+```
+pip install redis
+```
+
+2. start redis-server with docker-compose:
+
+```
+docker compose up -d
+```
+
+3. vim demo.py:
+```
+
+import redis
+
+r = redis.Redis(host='localhost', port=36379, db=0, password='123456')
+
+r.set('name', 'John')
+name = r.get('name')
+print(name.decode())  # Convert bytes to string
+
+r.delete('name')
+
+```