Small and lightweight GRPC cache memory service for use in distributed or separate systems with the ability to separate information from each system
- Clone project and compile or download release version from: https://github.com/nRafinia/GrpcCache/releases
- Add Cache Service to IIS or run InstallService.bat as administrator
- If use as service config port number
"Port": "37532"
- Add nuget
Install-Package GrpcCache
- Add Service url in AppSettings.json
"CacheMemory": "http://localhost:37532"
public void ConfigureServices(IServiceCollection services) { ... services.AddSingleton<ICacheMemory, CacheMemory>(); } private readonly ICacheMemory _cacheMemory; public HomeController(ICacheMemory cacheMemory) { _cacheMemory = cacheMemory; } public class Person { public string Firstname { get; set; } public string Surname { get; set; } public int Age { get; set; } public P2 Test { get; set; } } public class P2 { public string Name { get; set; } } var person = new Person() { Firstname = "Naser", Surname = "Rafinia", Age = 35, Test = new P2() { Name = "Test" } }; var cache = CacheMemory.GetInstance("http://localhost:37532/"); cache.AddOrUpdate("TestModel", person); var p = cache.Get<Person>("TestModel"); Console.Write($"Age is equal={person.Age == p?.Age}");