您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

34 行
666 B

  1. from contextlib import contextmanager
  2. try:
  3. import hiredis
  4. HIREDIS_AVAILABLE = True
  5. except ImportError:
  6. HIREDIS_AVAILABLE = False
  7. def from_url(url, db=None, **kwargs):
  8. """
  9. Returns an active Redis client generated from the given database URL.
  10. Will attempt to extract the database id from the path url fragment, if
  11. none is provided.
  12. """
  13. from redis.client import Redis
  14. return Redis.from_url(url, db, **kwargs)
  15. @contextmanager
  16. def pipeline(redis_obj):
  17. p = redis_obj.pipeline()
  18. yield p
  19. p.execute()
  20. class dummy(object):
  21. """
  22. Instances of this class can be used as an attribute container.
  23. """
  24. pass