Skip to content

Commit

Permalink
added flask caching
Browse files Browse the repository at this point in the history
  • Loading branch information
docsteveharris committed Jan 1, 2022
1 parent 83f844d commit 1959d3d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Untitled.ipynb
labbooks/*

# caches
cache-directory/*
*.swp
__pycache__/
*.py[cod]
Expand Down
8 changes: 8 additions & 0 deletions app/app_sitrep.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

conf = ConfigFactory.factory()

from flask_caching import Cache

cache = Cache(
app.server, config={"CACHE_TYPE": "filesystem", "CACHE_DIR": "cache-directory"}
)

TIMEOUT = 60 * 60 # measured in seconds


# TODO n_intervals arg is unused but just ensures that store data updates
@app.callback(
Expand Down
17 changes: 16 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ requests = "^2.26.0"
dash-daq = "^0.5.0"
arrow = "^1.2.1"
SQLAlchemy = "^1.4.28"
Flask-Caching = "^1.10.1"

[tool.poetry.dev-dependencies]
jupyterlab = "^3.2.1"
Expand Down

0 comments on commit 1959d3d

Please sign in to comment.