diff --git a/vizro-core/examples/_dev/app.py b/vizro-core/examples/_dev/app.py index e2b35e208..d8efa49ed 100644 --- a/vizro-core/examples/_dev/app.py +++ b/vizro-core/examples/_dev/app.py @@ -11,13 +11,15 @@ df = px.data.iris() -# Cache of default_expire_data expires every 5 minutes, the default -# data_manager.cache = Cache(config={"CACHE_TYPE": "FileSystemCache", "CACHE_DIR": "cache", "CACHE_DEFAULT_TIMEOUT": 20}) +# data_manager.cache = Cache(config={"CACHE_TYPE": "SimpleCache", "CACHE_DEFAULT_TIMEOUT": 20}) +data_manager.cache = Cache(config={"CACHE_TYPE": "FileSystemCache", "CACHE_DIR": "cache", "CACHE_DEFAULT_TIMEOUT": 20}) +# I didn't test this one yet: +# data_manager.cache = Cache(config={"CACHE_TYPE": "RedisCache"}) data_manager["default_expire_data"] = lambda: px.data.iris() # Set cache of fast_expire_data to expire every 10 seconds -data_manager["fast_expire_data"] = lambda: px.data.iris() -data_manager["fast_expire_data"].timeout = 5 +data_manager["fast_expire_data"] = px.data.iris() +# data_manager["fast_expire_data"].timeout = 5 # Set cache of no_expire_data to never expire data_manager["no_expire_data"] = lambda: px.data.iris() data_manager["no_expire_data"].timeout = 0 @@ -25,6 +27,7 @@ page = vm.Page( title="Blah", components=[ + vm.Graph(figure=px.scatter(df, "sepal_width", "sepal_length")), vm.Graph(figure=px.scatter(df, "sepal_width", "sepal_length")), vm.Graph(figure=px.scatter("default_expire_data", "sepal_width", "sepal_length")), vm.Graph(figure=px.scatter("fast_expire_data", "sepal_width", "sepal_length")), @@ -38,3 +41,6 @@ if __name__ == "__main__": app.run() + # app.run(processes=2, threaded=False) + # gunicorn -w 2 app:server -b localhost:8050 + # should also work with --preload