Implements dynamic cache tags throughout the storefront. This ensures that the cache will be invalidated for the current client only when server data mutates.
Added some logic to Nextjs middleware that generates a unique id and sets it in a _medusa_cache_id cookie.
Added a getCacheTag() helper function which takes in a string input. This will return a dynamic cache tag string in the format {input}-{_medusa_cache_id}. This is useful when revalidating tags after performing a mutation.
Added a getCacheHeaders() helper function which takes in a string input. This will return the next: {} headers to assign a dynamic cache tag to a GET request.
Implements dynamic cache tags throughout the storefront. This ensures that the cache will be invalidated for the current client only when server data mutates.
_medusa_cache_id
cookie.getCacheTag()
helper function which takes in a string input. This will return a dynamic cache tag string in the format{input}-{_medusa_cache_id}
. This is useful when revalidating tags after performing a mutation.getCacheHeaders()
helper function which takes in a string input. This will return thenext: {}
headers to assign a dynamic cache tag to a GET request.