Skip to content

A thread-safe caching infrastructure for caching data objects, which should be requested only once when needed from the data source (db, service or any type of data source)

oguzhankahyaoglu/CachedRepository.NetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

CachedRepository.NetCore

A thread-safe caching infrastructure for caching data objects, which should be requested only once when needed from the data source (db, service or any type of data source) Please see https://github.com/oguzhankahyaoglu/CachedRepository/blob/master/README.md for actual readme file. This is the .NetCore port of this project

To Install this package: Install-package CachedRepository.NetCore -pre

You must register LazyCache service which is a dependency for this package:

Add the LazyCache services in you aspnet core Startup.cs

// This method gets called by the runtime. Use this method to add services.
public void ConfigureServices(IServiceCollection services)
{
    // already existing registrations
    services.AddMvc();
    services.AddDbContext<MyContext>(options => options.UseSqlServer("some db"));
    ....

    // Register LazyCache - makes the IAppCache implementation
    // CachingService available to your code
    services.AddLazyCache();
    //Add all repository classes for Dependency Injection as Scoped variables (default)
    services.AddAllCachedRepositoriesAsServices(typeof(Application.Repositories.WorkExperienceRepo).Assembly, ServiceLifetime.Scoped);
    
}

About

A thread-safe caching infrastructure for caching data objects, which should be requested only once when needed from the data source (db, service or any type of data source)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages