Info
Version: | 1.0.0 |
Author(s): | Tomasz Margacz |
Last Update: | Sunday, January 14, 2018 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/RedisCache.Quick |
Install
Install-Package RedisCache.Quick
dotnet add package RedisCache.Quick
paket add RedisCache.Quick
RedisCache.Quick Download (Unzip the "nupkg" after downloading)
Dependencies
- StackExchange.Redis(>= 1.2.6)
- Newtonsoft.Json(>= 9.0.1)
Tags
This tool allows to easy set/get to cache service with using only one line of code.
If you have any questions or need improvement feel free to contact me: [email protected]
Sample code:
// init
RedisCacheQuick redis = new RedisCacheQuick("***.redis.cache.windows.net:***,password=***,ssl=***,abortConnect=***");
// set string
redis.StringSet("keyName_1", "Sample text.");
// get string
string value_1 = redis.StringGet("keyName_1");
// set any object - DateTime, int, double, ...
redis.Set("keyName_2", DateTime.UtcNow);
// get any object
DateTime value_2 = redis.Get<DateTime>("keyName_2");
// get object
DateTime? value_not_exists = redis.Get<DateTime?>("keyName_not_exists"); // return value will be null
// set own object
redis.Set("keyName_3", new Employee(1, "Name1"));
// get own object
Employee value_3 = redis.Get<Employee>("keyName_3");
---
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public Employee(int id, string name)
{
this.Id = id;
this.Name = name;
}
}.