diff --git a/app.py b/app.py index fd7d858..c9c1e66 100644 --- a/app.py +++ b/app.py @@ -266,6 +266,11 @@ def add_account() -> Union[Response, str]: # Clear cache for user accounts route cache_key = f"view/{session['username']}/accounts" cache.delete(cache_key) + # Also clear memoized version for good measure + cache.delete_memoized(user_accounts, key_prefix=make_cache_key) + # Clear home page cache as well since it shows account stats + cache_key_home = f"view/{session['username']}/home" + cache.delete(cache_key_home) # Run the NPM config update in a background thread thread = threading.Thread(target=_update_npm_config_in_background) thread.start() @@ -286,6 +291,11 @@ def delete_account() -> Response: # Clear cache for user accounts route cache_key = f"view/{session['username']}/accounts" cache.delete(cache_key) + # Also clear memoized version for good measure + cache.delete_memoized(user_accounts, key_prefix=make_cache_key) + # Clear home page cache as well since it shows account stats + cache_key_home = f"view/{session['username']}/home" + cache.delete(cache_key_home) return redirect(url_for("user_accounts")) @app.route("/validateAccount", methods=["POST"]) @@ -306,6 +316,9 @@ def validate_account() -> Tuple[Response, int]: response_data = response.json() if response_data.get("message") == "Account is valid and updated": cache.delete_memoized(user_accounts, key_prefix=make_cache_key) + # Also clear regular cache for good measure + cache_key = f"view/{session['username']}/accounts" + cache.delete(cache_key) # Run the NPM config update in a background thread thread = threading.Thread(target=_update_npm_config_in_background) thread.start()