0

We created a custom pagelist source as described here by Richard. So we have a class that implements IDatasource and returns an array of items.

The returned item set can be different for each language - we do have a lot of languages and some items are not created in all languages and we intentionally have no fallback.

The datasource is working fine... on the first call. We noticed that when we switch language the items are not correct. When a debugger is attached to our code, it is being called on a fresh start but after that it is not called anymore if we refresh the page of switch language. As we do have different results for multiple languages this goes wrong.

I assume it's some caching as it works again after a publish. Once.. and then it's cached again.

How can I make this work for multiple languages?

1 Answer 1

3

I did some investigation and found it is caching indeed. If I clear the caches on /sitecore/admin/cache.aspx the code is triggered again (once).

As the "code:" datasources is resolved in the resolveRenderingDatasource pipeline I checked that one and saw a GetCache and SetCache processor. So yes, that data is cached. And no, the language is not part of the cache key (thx dotPeek).

We have a ticket open with Sitecore support to fix this - but in the meantime we are able to turn off the cache to fix the issue temporarily: there is a setting called XA.Foundation.LocalDatasources.ResolveRenderingDatasourceCache.Enabled - if you set that to false the cache won't be used anymore and the PageList works in a multilingual environment with our coded source.

Update: The final solution can be found on my blog as well: overriding the GetFromCache and SetCache classes in the resolveRenderingDatasource pipeline to generate a language-dependent key does the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.