This is a guide to get started with Redis cache on .NET.
- Create a new visual studio console project. Then right click selects on Manage Nu-Get packages and select online option and search for “StackExchange” in the search field and install StackExchange.Redis.
- Now to get connected to Redis and its database here is a snippet.
// This should be stored and reused
var redis = ConnectionMultiplexer.Connect(“localhost”);
// IDatabase is simple object which is cheap to build
IDatabase db = redis.GetDatabase();
- To save a string value into a database:
- In order to test this, we need to find out the value for key name.
So, this is how you can get started with Redis cache using .NET to save and retrieve values in and out of a database.
Here is the video tutorial of the same:
Thanks for stopping by !!! Feel free to comment to this post or you can also drop me an email at email@example.com.