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

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

License

Notifications You must be signed in to change notification settings

nRafinia/GrpcCache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

  • Add nuget

    Install-Package GrpcCache

  • Add Service url in AppSettings.json

    "CacheMemory": "http://localhost:37532"

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

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

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages