Open daberlin opened 1 year ago
Hi. I'm using Redis as a caching backend for Zeep in a project of mine. Maybe it would be helpful for others to add the below (minimal) sample to the docs:
class ZeepRedisCache(zeep.cache.Base): redis = None expiry = None def __init__(self, redis_host: str, redis_db: int, expiry: int = 86400) -> None: self.redis = redis.Redis(host=redis_host, db=redis_db) self.expiry = expiry def add(self, url: str, content: bytes) -> None: self.redis.setex(url, self.expiry, content) def get(self, url: str) -> bytes | None: return self.redis.get(url)
Hi. I'm using Redis as a caching backend for Zeep in a project of mine. Maybe it would be helpful for others to add the below (minimal) sample to the docs: