Re:Ring: Advanced cache interface for Python
by vngzs on Tuesday May 28, 2019 @10:46AM
(#20030621)
You can use a closure to pass in the configuration.
Then in your code which imports the above library:
[ Parent
| on HN ]
Re:Ring: Advanced cache interface for Python
by coleifer on Tuesday May 28, 2019 @02:47PM
(#20033091)
I'd rather have a sane API.
def configure_ring():
if DEBUG:
return Ring(backend='debug')
else:
return Ring(backend='memcache', ...)
ring = configure_ring()
@ring.cache(expire=60)
def get_url(...):
...
Tons of other libraries out there that implement this exact pattern.
Re:Ring: Advanced cache interface for Python
by youknowone on Tuesday May 28, 2019 @03:05PM
(#20033249)
agree