Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Latest commit

 

History

History
64 lines (50 loc) · 1.6 KB

README.md

File metadata and controls

64 lines (50 loc) · 1.6 KB

GrpcCache

Small and lightweight GRPC cache memory service for use in distributed or separate systems with the ability to separate information from each system

Install Service:

Use in Clients:

Example

ASP.Net Core

public void ConfigureServices(IServiceCollection services)
{
  ...
  services.AddSingleton<ICacheMemory, CacheMemory>();
}

private readonly ICacheMemory _cacheMemory;
public HomeController(ICacheMemory cacheMemory)
{
  _cacheMemory = cacheMemory;
}

Console App

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("https://localhost:37532/");

cache.AddOrUpdate("TestModel", person);
var p = cache.Get<Person>("TestModel");

Console.Write($"Age is equal={person.Age == p?.Age}");