C#C
C#4mo ago
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
Was this page helpful?