© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•6mo ago•
9 replies
Tristen

✅ Cache vs Persistence Repository and DI

anyone have recommendations, for a asp.net backend, a decent way to cache db results and make available to services? I was trying to register the cache as a singleton and the persistence repository as scoped, but I haven't fingered out an elegant way to do it. I figure this problem must have been solved a long time ago.

I was thinking, services should NOT care if its CacheRepository or SqlServerRepository or PostgresRepository as long as it is IRepository, but I couldn't figure out how to make Cache IRepository as a singleton periodically refreshing from Postgres IRepository as a scoped
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Ctor DI vs IServiceProvider.GetService
C#CC# / help
4y ago
❔ Session vs Cookies vs Cache
C#CC# / help
3y ago
DI and Views
C#CC# / help
13mo ago
❔ ASP.NET builtin cache vs Redis Cache ?
C#CC# / help
3y ago