Closed matt-sd-watson closed 6 months ago
I have added the following paragraph to the docs to make this point more clear,
Per default, the Serverside
object generates a (new) unique key for every callback invocation to ensure that data is never shared between invocations and/or sessions. However, if this is not a requirement, using a fixed key will reduce the data usage of the backend significantly, as only a single copy of the data will be stored (instead of one per callback invocation).
I have created a Flask and dash app that uses dash components, including the
ServersideOutputTransform
, to cache and store large dictionaries of arrays. The component works very well for my requirements.I recently discovered that specifying the same
key
string forServerside
objects in different callbacks allows the transform to overwrite the previous pickle files in the specified backend directory. Previously, without any unique key, the transform would create a new pickled object, and this would cause a lot of duplicate data writing to the temporary cache, as well as cause the temporary cache to become populated very quickly with many pickle files.I would suggest explicitly explaining in the documentation how the
key
parameter forServerside
objects works, as this can save a great deal of disk space whenServerside
objects are constantly being updated from different callbacks. Now, when using a unique key, I can drastically reduce the amount of disk space required for myServerside
objects in session.