1.python连接redis
from django.test import TestCase import redis
conn = redis.Redis(host='127.0.0.1') conn.set('key1', 'v1') conn.hset('n2', 'k2', 'v2') print(conn.get('key1'))
1.python连接redis
from django.test import TestCase import redis
conn = redis.Redis(host='127.0.0.1') conn.set('key1', 'v1') conn.hset('n2', 'k2', 'v2') print(conn.get('key1'))