-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Port System.Runtime.Caching to .NET Core #19691
Comments
This is the first request for this API. cc: @weshaggard @danmosemsft - any comments on our usage data? |
from the reference code I am seeing the used classes are:
and the enum
|
Which libraries need them and why? (disclaimer: I have 0 knowledge about the APIs) |
The code consuming the classes CacheItemPolicy and MemoryCache is the open source library AlexaSkillsKit.dll in https://github.com/AreYouFreeBusy/AlexaSkillsKit.NET/tree/ef7f2259a74f052c0980c200fe0caf891e4d4092/AlexaSkillsKit.Lib System.Runtime.Caching namespace is defined in the full framework in a library called System.Runtime.Caching.dll and the whole library never get ported to net core |
@karelz usage is about 2% based on nuget and apiport telemetry : https://apisof.net/catalog/System.Runtime.Caching |
My company would need System.Runtime.Caching to port our apps to .NET core as well. |
@weshaggard could you please advise regarding this namespace porting? |
System.Runtime.Cachine is the correct namespace. These APIs have transitionally been used for web scenarios and the ASP.NET team has traditionally owned them. |
Should we ask ASP.NET team to ship them in their libraries instead of CoreFX then? |
We replaced System.Runtime.Caching with http://github.com/aspnet/Caching but that might be unrelated to this porting exercise since this is about bringing back older APIs. |
@karelz looking at the new APIs porting seems possible but is not super direct. Our use of the existing APIs is woven through a number of internal libraries which would each need to take on a breaking change as well as a number of new dependencies to start using the aspnet APIs. Two additional potential concerns I have about switching to the new aspnet APIs:
From our perspective, System.Runtime.Caching would be released as its own NuGet package to aid in porting while not cluttering the core framework. That said, I can understand if this doesn't get prioritized given that there is a reasonable alternative available. |
Disclaimer: I don't have any deeper knowledge of the caching APIs, so please be patient with me if my answers seem irrelevant or obvious for person who knows the APIs.
The original MemoryCache was also developed mainly for ASP.NET scenario (technically by ASP.NET team). From that perspective the risk in non-web use cases is the same for both - the old and new APIs. The old APIs have additional the downside/risk of not being actively maintained/developed at all.
The whole .NET platform (incl. .NET Core) takes compatibility very seriously. I don't think there is any reason to be more worried about new ASP.NET APIs breaking compat than to be worried about compat breaking in general (or if we ported the old APIs being afraid of compat changes in that code).
Helping apps migrate to .NET Core is one of the key values we're focusing on. We prioritize the most popular APIs over the rarely used APIs. However, we do not plan to chase the tail -- if some API is less used and we do not believe it is must-have and there are not many customers who truly need it, we do not plan to bring it over ever. Given that we have "only" 2 asks so far for this API and that there is an alternative API, we do not plan to invest into the API. However, if in the future we see more interest from developers, we may change our view point / prioritization. |
@karelz thanks that all makes sense to me. I mostly wanted to get in my "vote" for porting this, with full understanding that it might not make sense to do so now or ever. |
Great. Vote is noted, thank you! (BTW: Upvoting the original post would be best - GitHub can sort by that ;-)) Just to reiterate what I said above: We will happily reprioritize / change our view point in future if we see more interest in the library from more customers. |
I suggest that we add this since it doesn't seem that hard to get to run on .NET Core. @weshaggard if there aren't any objections, we can put this up for grabs. I'd like to note that our official docs do say it can be used outside of ASP.NET, in fact if I remember correctly it was moved out of System.Web for such scenarios. |
I don't have any objections to adding it if we can make it work reasonably as a standalone component. |
@karelz @davidfowl I vote for that System.Runtime.Caching is NOT needed in the "new" world as we have all kinds of other alternatives now. And it would be kinda confusing to have to decide between that cache and Microsoft.Extensions.Caching.MemoryCache as they probably will be doing 99% exactly the same thing. Porting existing apps might be an issue, but if you use a caching abstraction and DI, you'll find that process being very simple, just change it in one place... There are also libraries which do that abstraction for you, like https://github.com/MichaCo/CacheManager which supports the old RuntimeCaching and the new stuff. |
Thanks @MichaCo for your view point. |
As a library author, I'd like to see it in. We have many providers for various bits of storage,
This is a relatively simple structure, and to reduce pain all around (including porting pain), it should make the trip. |
I agree it should be ported. We replaced Mono's implementation with the one from referencesource ~2 years ago but had to reimplement internal classes like UsageEntryRef, CacheUsage, ExpiresEntryRef and CacheExpires because they are missing from referencesource for some reason so it'd be great to get rid of that code 😄 |
It's worth noting that what @akoeplinger mentions makes up-for-grabs a bit interesting...since we don't actually have the source for that. I have no idea why they were never in reference source, it's also annoyed us for the better part of a decade when debugging :) |
OK, we seem to have quite a few folks interested in this. @NickCraver @akoeplinger can you please file a new bug to track missing code on ReferenceSource? |
Let's stick to desktop, I did a cursory glance a while back and it was just a copy paste dump that we'd need to do. |
@mjsabby did you look at tests? |
@karelz our code is referencesource based modulo missing bits. We have been promised publishing of missing internal types on several occasions during past year(s) but still no action. |
@marek-safar that's a good data point - who did you talk with in the past? I'll be happy to push on it. |
I have created issue to track missing ReferenceSource - dotnet/corefx#16441 |
Our codebase has a lot of references to |
I have also used this type in my apps. I upvoted. |
Hi, we are looking at this interface in the API-throttling context as shown here on stackexchange Or is there a viable alternative cache in this context? Thanks |
+1 |
I guess this one (that I need) is one of the 43 that are in netfx461 but not in netstandard20? |
@StingyJack no, the 43 APIs in the other direction - those are APIs which ARE in netstandard20, but not in netfx461. |
@karelz - had to read it a few times, but I see what you mean. Is there a list of those diffs? I remember seeing something similar circa .net core10 preview that listed namespaces that weren't yet migrated. |
I think @weshaggard had a diff between platforms. |
+1 |
@greenbergjosh no decision or timeline yet. |
@danmosemsft whats left on this one? |
This is done except minor issues dotnet/corefx#26171 and possible Unix port dotnet/corefx#26172 It also needs to go up on Nuget with S.R.Caching added - @safern is doing this now. |
any news about this? when it is planned to release this nuget package? |
This is done and complete. The package is available on Nuget: |
Thank you. good news |
this https://www.nuget.org/packages/System.Runtime.Caching/ solved for me! |
In attempting to convert some libs to .NET Core for use in where .NET Core is growing (e.g., AWS Lambdas), I'm blocked on System.Runtime.Caching components or an equivalent.
The text was updated successfully, but these errors were encountered: