Show and Tell - Server Side Caching

Thanks! No, it’s the same (in fact, the arguments are passed to the flask caching FileSystemCache class under the hood). You would simply create the store with the desired configuration,

from dash_extensions.enrich import FileSystemStore
fss = FileSystemStore(threshold=1)

and bind it either as the default backend (i.e. it will be used for all serverside outputs),

from dash_extensions.enrich import Dash
app = Dash(output_defaults=dict(backend=fss, session_check=True))

or to the desired outputs,

@app.callback(ServersideOutput("store", "data", backend=fss), Trigger("btn", "n_clicks"))

However, keep in mind that i haven’t implemented any graceful handling of missing (overwritten) cache values. Hence if you make the cache too small so that values of active clients are overwritten, their applications will crash.

1 Like