We are facing an issue with DXA cache in below usecase.
SDL 9.6 DXA version: 2.2.33
- We have a paginated view and each page will have a list of items.
- On each paginated links (ex. Jan, Feb etc) we are making a post request with payload having query parameters to get next set of items.
- For each request the page URL is constant but with different parameters in payload.
DXA cache config
- Cache is enabled
- On first request i.e Jan we get proper data but on second request i.e Feb we get Jan's data which got cached in previous request.
- This is because the cache key is generated by DXA based on path and not considering the query params.
Workarounds we have tried
- Used @NoOutputCache on the list entity but didn't help.
- Used @NeverCached on list entity. This actually fixed the problem but we are facing performance issues. Page load is taking longer time. So we decided to not go with this approach.
Other analysis and tweaks we are trying
- In AbstractContentProvider we found that the key is generated using the path. In our case it is always constant.
- Tried to pass a unique path by appending query params to make the key unique. Here the PageModel key is unique now but the data in PageModel is still old cached data.
Is there a way to make dxa cache manager to generate unique key based on query params? Or Is there any other solution? Your help would be much appreciated.