Lucid KV Client for C# / .NetCore Language
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();
}
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();
}
}