Skip to content

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

License

Notifications You must be signed in to change notification settings

lucid-kv/lucid-sharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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