Skip to content

Commit

Permalink
Comment on app
Browse files Browse the repository at this point in the history
  • Loading branch information
antonymilne committed Apr 5, 2024
1 parent e0b8725 commit c9b9fb5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions vizro-core/examples/_dev/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@

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

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")),
Expand All @@ -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

0 comments on commit c9b9fb5

Please sign in to comment.