This repository has been archived by the owner on Oct 23, 2023. It is now read-only.
Factory should implement caching #50
Comments
Hi, Seems that you're totally right. Removing the Factory is quite easy. The bid deal is to keep benchmark and test project working |
AlexTeixeira
added a commit
that referenced
this issue
May 1, 2019
AlexTeixeira
pushed a commit
that referenced
this issue
May 2, 2019
AlexTeixeira
pushed a commit
that referenced
this issue
May 2, 2019
See version 2.1.0-preview-1 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
In the default implementation of IStringLocalizerFactory, they do IStringLocalizer caching (using ConcurentDictornary). According to feedback from the .NET CORE development team, if one decides to implement a custom IStringLocalizerFactory they should implement caching them self.
Implementation should cache localizers to prevent them from being created needlessly.
Unfortunately your test case is small controller so you can't reproduce this issues. In my case, where there is massive use of ISTringLocalizer, it is called many times.
Why was there a need to implement the JsonStringLocalizerFactory? As far as I can tell, you could have solved it all just by using the IStringLocalizer implementation and just keep using the Microsoft default IStringLocalizerFactory (that uses caching)
I will try to make it work without it in my scenario because I currently don't see the benefit of Factory customization. But please let me know if I am missing something...
tnx!
Luka
The text was updated successfully, but these errors were encountered: