Skip to content

Gatsby-Lee/retry-redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retry-redis

Redis Clieht with customizable retrying capability.

Why did I build this?

There are Redis exceptions like below that can be handled by simply retrying it.

This package is built in order to help people who need to solve same problem.

  • redis.exceptions.ConnectionError
  • redis.exceptions.ResponseError
  • redis.exceptions.TimeoutError

Who should use?

Anybody who wants to have retry logic with Redis.

How to Install

pip install retry-redis

How To Use

Simply import retry decorated Redis and Use it.

import logging
from retry_redis import Redis

logging.basicConfig(level=logging.DEBUG)

r = Redis(port=6666)
r.lpush('list:test', 1)

# This log will be printed.
# DEBUG:retry_redis.decorated_redis:Finished call to 'redis.client.Redis.lpush' after 0.002(s), this was the 1st time calling it.
# DEBUG:retry_redis.decorated_redis:Finished call to 'redis.client.Redis.lpush' after 2.005(s), this was the 2nd time calling it.
# DEBUG:retry_redis.decorated_redis:Finished call to 'redis.client.Redis.lpush' after 6.009(s), this was the 3rd time calling it.

Package Dependency

  • redis
  • tenacity

About

redis-py with retry decoration

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published