vue: SSR Component Cache doesn't cache Strings
Version
2.5.13
Reproduction link
https://runkit.com/martinlg/issue-vue-renderer-cache
Steps to reproduce
Run the Runkit code. If you prefer a git repository I can provide you one.
What is expected?
The value passed to the set function should be a string.
What is actually happening?
The value passed to the set function is an object, with 2 properties:
- html: a
stringcontaining the rendered component - components: a
Setcontaining nothing or function, depending on context (sub-components I think)
This issue breaks any external cache possibility (Redis in my case). The only possible cache is in the process memory, like the LRUCache, but it seems impossible to scale processes and share a common cache.
Moreover, the documentation explain clearly that the cached value should be a string, and even provides a small Redis example implementation, that could just not work.
I think that the documentation describe the expected behavior, so I don’t want to “fix” the documentation, I think we should fix the behavior.
I will try to help but I may need some explanations on some parts of the RenderContext, can I ask my questions on this thread ?
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 14
- Comments: 15 (1 by maintainers)
Wow, this is just extremely disappointing. Especially since the SSR docs explicitly show a redis client example. https://ssr.vuejs.org/api/#cache
Any updates on this? Having same issue with redis client.
I don’t believe caching doesn’t work as it should be o_O Maybe some PR will help fix this? And it still opened… from February? Does no one use the cache or what?
Actually, I don’t see why we should cache component’s lifecycle in rendering.
The component should be rendered, its template should be cached as a string (the html part of the currently stored object). Then when the component get fetched from the cache, it’s template is static, and should not depend of the store. So I don’t see why we should register all its child components.
Of course the browser takes back the hand, and make them dynamic like every components.
Did I miss something ?
the same issue . I want to use redis client , but the components is a Set .
Has there been any progress on this or has everyone given up on having a shared cache?