Skip to content

Support caching queries with autodiscovered types #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

fredericDelaporte
Copy link

@fredericDelaporte fredericDelaporte commented Oct 2, 2022

Copy link
Author

@fredericDelaporte fredericDelaporte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a fix supporting caching those queries with autodiscovered types and transformers.

But should this go in 5.3.x, or better do that on 5.4 ?

Comment on lines +91 to +94
if (cached && key.ResultTransformer?.AutoDiscoverTypes == true && key.ResultTransformer.AutoDiscoveredAliases != null)
{
Cache.Put(new QueryAliasesKey(key), key.ResultTransformer.AutoDiscoveredAliases);
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we need aliases, this adds them to the cache for allowing retrieving them.

I though about using a local concurrent dictionary, but that would not work with distributed caches. We need theses aliases to be in distributed caches too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, this works only for non-obsoleted Get. So, the bug would remain for users having an obsolete custom query cache implementation. I think this is acceptable.

@fredericDelaporte
Copy link
Author

I have not regenerate async, so the async code is still failing. That is the only failure I have seen in the build I have looked.

@fredericDelaporte fredericDelaporte deleted the GH3169-Cached branch October 16, 2022 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant