Skip to content

Commit 45abf5c

Browse files
committed
fix cache key issue
1 parent a00407d commit 45abf5c

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

dash/_callback.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def add_context(*args, **kwargs):
398398
# Inputs provided as dict is kwargs.
399399
func_args if func_args else func_kwargs,
400400
long.get("cache_args_to_ignore", []),
401+
callback_ctx.get("triggered_inputs", []),
401402
)
402403

403404
if old_job:

dash/long_callback/managers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def get_result(self, key, job):
5454
def get_updated_props(self, key):
5555
raise NotImplementedError
5656

57-
def build_cache_key(self, fn, args, cache_args_to_ignore):
57+
def build_cache_key(self, fn, args, cache_args_to_ignore, triggered):
5858
fn_source = inspect.getsource(fn)
5959

6060
if not isinstance(cache_args_to_ignore, (list, tuple)):
@@ -68,7 +68,7 @@ def build_cache_key(self, fn, args, cache_args_to_ignore):
6868
arg for i, arg in enumerate(args) if i not in cache_args_to_ignore
6969
]
7070

71-
hash_dict = dict(args=args, fn_source=fn_source)
71+
hash_dict = dict(args=args, fn_source=fn_source, triggered=triggered)
7272

7373
if self.cache_by is not None:
7474
# Caching enabled

dash/long_callback/managers/celery_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, celery_app, cache_by=None, expire=None):
2626
:param cache_by:
2727
A list of zero-argument functions. When provided, caching is enabled and
2828
the return values of these functions are combined with the callback
29-
function's input arguments and source code to generate cache keys.
29+
function's input arguments, triggered inputs and source code to generate cache keys.
3030
:param expire:
3131
If provided, a cache entry will be removed when it has not been accessed
3232
for ``expire`` seconds. If not provided, the lifetime of cache entries

dash/long_callback/managers/diskcache_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, cache=None, cache_by=None, expire=None):
2525
:param cache_by:
2626
A list of zero-argument functions. When provided, caching is enabled and
2727
the return values of these functions are combined with the callback
28-
function's input arguments and source code to generate cache keys.
28+
function's input arguments, triggered inputs and source code to generate cache keys.
2929
:param expire:
3030
If provided, a cache entry will be removed when it has not been accessed
3131
for ``expire`` seconds. If not provided, the lifetime of cache entries

0 commit comments

Comments
 (0)