lucid-kv / lucid-sharp

Lucid client for the C# language. High performance and distributed KV store w/ REST API. 🦀

Home Page:https://www.nuget.org/packages/lucid-sharp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lucid KV

lucid-sharp

Lucid KV Client for C# / .NetCore Language

How to Use?

You simply need to add this lines to Startup.cs file:

public void ConfigureServices(IServiceCollection services)
{
    services.AddLucidCache(options =>
    {
        options.Configuration = "https://lucid-kv.herokuapp.com/";
        options.InstanceName = "LucidPublicNode";
    });

    services.AddControllers();
}

Consume it with dependency injection (DI)

public class HomeController : Controller
{
    private readonly IDistributedCache _distributedCache;

    public HomeController(IDistributedCache distributedCache)
    {
        _distributedCache = distributedCache;
    }

    public IActionResult Index()
    {
        // Store String
        // Hello World! is written in https://lucid-kv.herokuapp.com/api/kv/hello_world
        _distributedCache.SetString("hello_world", "Hello World!");        

        // Directly store an image
        _distributedCache.Set("hello_world", System.IO.File.ReadAllBytes("/tmp/profile_picture.jpg"));
        return View();
    }
}

About

Lucid client for the C# language. High performance and distributed KV store w/ REST API. 🦀

https://www.nuget.org/packages/lucid-sharp/

License:MIT License


Languages

Language:C# 100.0%