Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URL Caching and Optimize Cache Refreshing #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mohammadaminmg10
Copy link

@mohammadaminmg10 mohammadaminmg10 commented Sep 27, 2023

This pull request introduces two important changes to the codebase, both of which are aimed at improving the caching mechanism:

  1. Fix URL Caching by Setting ForceQuery to false:
    We've identified an issue where URLs without query parameters were incorrectly affecting the cache key due to the presence of a question mark at the end of the URL. To resolve this issue, we've explicitly set ForceQuery to false for c.Request().URL. This change ensures that a URL without question mark is not different from the same URL with just a question mark at the end of it , resulting in more accurate caching behavior.
  2. Optimize Cache Refreshing by Refreshing Before Deleting:
    We've identified a performance optimization opportunity in the cache refreshing process. Previously, the code first deleted the cache key and then attempted to fetch a new value. This sequence of operations could result in a delay in cache refreshing. To improve this, we've modified the code to refresh the cache with a new value first and then delete the old cache key. This modification results in faster cache refreshing and more consistent behavior.

These changes address two significant issues in the caching mechanism. The first change ensures that URLs with query parameters are correctly cached, and the second change optimizes the cache refreshing process for improved performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant