feat: provide app-wide cache
This commit is contained in:
parent
d44301ef14
commit
1c79c58ac6
2 changed files with 6 additions and 4 deletions
2
cache/cache.py
vendored
Normal file
2
cache/cache.py
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
from flask_caching import Cache
|
||||
cache = Cache()
|
8
web.py
8
web.py
|
@ -1,22 +1,22 @@
|
|||
from flask import Flask, send_from_directory
|
||||
from flask_caching import Cache
|
||||
import sentry_sdk
|
||||
import json
|
||||
from cache.cache import cache
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
try:
|
||||
from threads.threads import threads
|
||||
app.register_blueprint(threads, url_prefix='/threads')
|
||||
print(' * Threads blueprint registered')
|
||||
except ImportError:
|
||||
print(' ! threads blueprint missing')
|
||||
print(' ! Threads blueprint not found')
|
||||
|
||||
app.config.from_file("config.json", load=json.load)
|
||||
|
||||
# caching
|
||||
cache = Cache()
|
||||
cache.init_app(app)
|
||||
print(' * Cache type: ' + app.config["CACHE_TYPE"])
|
||||
cache.init_app(app)
|
||||
|
||||
# perf monitoring & error tracking
|
||||
sentry_config = app.config["SENTRY"]
|
||||
|
|
Loading…
Reference in a new issue