Skip to content

Latest commit

 

History

History
59 lines (50 loc) · 1.83 KB

README.md

File metadata and controls

59 lines (50 loc) · 1.83 KB

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();
    }
}