Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lingyielia committed Oct 26, 2023
1 parent c428f49 commit be91776
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 13 additions & 5 deletions vizro-core/examples/default/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def empty_cache(empty_button_id_n_clicks):
function=delete_memoized_cache(),
inputs=["delete_button_id.n_clicks"],
)
]
],
),
vm.Button(
id="empty_button_id",
Expand All @@ -93,8 +93,8 @@ def empty_cache(empty_button_id_n_clicks):
function=empty_cache(),
inputs=["empty_button_id.n_clicks"],
)
]
)
],
),
],
controls=[
vm.Filter(
Expand All @@ -116,7 +116,11 @@ def empty_cache(empty_button_id_n_clicks):
# "CACHE_THRESHOLD": 20, # The maximum number of items the cache can hold
# "CACHE_DEFAULT_TIMEOUT": 3000, # Unit of time is seconds
# }
# # data_manager._cache.config = {"CACHE_TYPE": "RedisCache", "CACHE_REDIS_URL": "redis://localhost:6379/0", "CACHE_DEFAULT_TIMEOUT": 120}
# data_manager._cache.config = {
# "CACHE_TYPE": "RedisCache",
# "CACHE_REDIS_URL": "redis://localhost:6379/0",
# "CACHE_DEFAULT_TIMEOUT": 120,
# }
# app = Vizro()
# app.build(dashboard)
# server = app.dash.server
Expand All @@ -131,7 +135,11 @@ def empty_cache(empty_button_id_n_clicks):
# "CACHE_THRESHOLD": 20, # The maximum number of items the cache can hold
# "CACHE_DEFAULT_TIMEOUT": 3000, # Unit of time is seconds
# }
data_manager._cache.config = {"CACHE_TYPE": "RedisCache", "CACHE_REDIS_URL": "redis://localhost:6379/0", "CACHE_DEFAULT_TIMEOUT": 60,}
data_manager._cache.config = {
"CACHE_TYPE": "RedisCache",
"CACHE_REDIS_URL": "redis://localhost:6379/0",
"CACHE_DEFAULT_TIMEOUT": 60,
}
Vizro().build(dashboard).run()
# Vizro().build(dashboard).run(
# threaded=False,
Expand Down
4 changes: 4 additions & 0 deletions vizro-core/src/vizro/managers/_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def _clear(self):

# to clear original data if the cache type is not NullCache
def _clean_original_data(self):
"""Clean up original data if the cache type is not NullCache.
This only drops the original data if the same key is in the lazy data.
"""
logger.debug(f"__original_data before cleaning: {self.__original_data.keys()}")
# logger.debug(f"config: {self._cache.config}")
logger.debug("clean original data")
Expand Down

0 comments on commit be91776

Please sign in to comment.