VSF Redis cache - dynamic parts will be disappeared after a while
Hi everybody,
we have implemented redis cache with VSF project (SSR Cache), but we faced an issue, I just wanted to know if anyone else faced the same problem.
When we call the page for the first time, everything is fine for a while... but after a while the content of the cached paged will be changed. (30 mins, or minutes, I do not know the exact amount, may be it's after an event)
How?
The page will be rendered as usual, except the dynamic parts, for example in home page menu items and products will be removed from the cache content.
It means that the cache value within redis will be changed, when I investigated the value of the home key, I noticed that the dynamic parts are not there.
we have followed the normal configuration: https://docs.vuestorefront.io/v2/performance/ssr-cache.html tags are exactly like the doc. First, we got the error on server, I have the same setup on my system, (VSF + + nodejs + redis server), so I found that, there is probably some problems within caching mechanism, and it does not come from my setup. The page will look like the attached image. Anyone else with the same issue? Just asking, because I'm still investigating the problem. thank you all
we have followed the normal configuration: https://docs.vuestorefront.io/v2/performance/ssr-cache.html tags are exactly like the doc. First, we got the error on server, I have the same setup on my system, (VSF + + nodejs + redis server), so I found that, there is probably some problems within caching mechanism, and it does not come from my setup. The page will look like the attached image. Anyone else with the same issue? Just asking, because I'm still investigating the problem. thank you all
12 Replies
Hey @samberry! That sound interesting, let me check it with our engineers, cause honetsly, I haven't experienced this myself!
Thank youuu,
I'm checking it on my local too, I will update this post if I have any other info.
Sam, can you drop you nuxt.config.js file for the SSR part? Or is it exactly the same as per example in docs?
Sure, it's exactly like that, but let me copy it.
['@vue-storefront/cache/nuxt', {
enabled: true,
invalidation: {
endpoint: '/cache-invalidate',
key: 'uniqueKey',
handlers: [
'@vue-storefront/cache/defaultHandler'
]
},
driver: [
'@vue-storefront/redis-cache',
{
defaultTimeout: 86400,
redis: {
host: 'localhost',
port: 6379
}
}
]
}]
dependency versions:
"@vue-storefront/cache": "^2.7.5",
"@vue-storefront/redis-cache": "^1.0.1",
Home.vue
import { useCache, CacheTagPrefix } from '@vue-storefront/cache';
.....
onSSR(async () => {
await productsSearch({ featured: true });
addTags([
{ prefix: CacheTagPrefix.View, value: 'home' }
]);
});Hey Sam, can you please also give me a bit more info. What was the error on the server?
We havenβt had this error before so we would like to know as much info as possible π
Hmm, unfortumately there is not any console or server error... π
Server sends back responses without error but the actual behaviour is not correct, as the final HTML cached in redis is somehow corruped. How? The final result does not have just dynamic parts..
Anyway, it's very weird that I have this defect on both local and server..
I will do more deeper tests to give you more info ππ»
Please do! If itβs something wrong with vsf app, open the issue on GH and we will take a look at and resolve asap π
Unknown Userβ’2y ago
Message Not Public
Sign In & Join Server To View
update:
as we have investigated there is a problem within PrestaShop integration when we have more than one lang (which will be fixed soon). So, it's not an issue with VSF cache (except default validation handler..).
When you check my message, we can remove this post. @skirianov
thank you
Hey @samberry glad you found the issue! Haven't helped you much tho π
Mark the question as answered! π
π
thanks for following up and your help.
Sure.
anyway, still we have the issue with default handler:
https://discord.com/channels/770285988244750366/1072426511707152466
https://github.com/vuestorefront/vue-storefront/issues/6884
@skirianov
just to remind, I think you were not involved..
thanks
GitHub
[Bug]: Default Invalidation Handler does not work correctly Β· Issue...
Describe the Bug We used redis cache driver, and caching is working very well. When I call the invalidation URL I get error (default invalidation handler): [dev:theme] ERROR [VSF][error]: Cache dri...