sleep ( 0.5 ) ( '/' ) def hello (): count = get_hit_count () return 'Hello World! I have been seen times. ConnectionError as exc : if retries = 0 : raise exc retries -= 1 time. Redis ( host = 'redis', port = 6379 ) def get_hit_count (): retries = 5 while True : try : return cache.
Import time import redis from flask import Flask app = Flask ( _name_ ) cache = redis.