![]() ![]() Public string GetStringValue( string key) Now that I have a connection factory, it’s very simple to create a class which acts as an agent to allow me to read, write and delete string values from the Redis database. Public static ConnectionMultiplexer GetConnection() => Connection. Parse(connectionString) Ĭonnection = new Lazy(() => ConnectionMultiplexer. I added these in the project.json file using the code below, and restored the packages using “dotnet restore”. Once this project is created, I need to add a couple of libraries – the StackExchange.Redis library, and. NET Core project – I’ve called mine RedisAPI. NET Core project and class to connect to Redisįirst we simply create a new. ::SetEnvironmentVariable("REDIS_CONNECTIONSTRING", "localhost", "Machine") Step 3: Create the. I’ve previously written about this technique. So I’ll create an environment variable called “REDIS_CONNECTIONSTRING” with this value. The simplest connection string is really simple – it’s just “localhost”. Step 2: Create an environment variable to connect to Redis This process will also install a Windows service for the Redis database. This is a fairly simple and straightforward installer – there were a few decision points, such as adding the installation directory to the machine’s pathĪlso you can choose which port that Redis runs on – 6379 is usually used for non-SSL access, or 6380 for SSL. (You should read the information on this site to determine the if this is best version for you). I downloaded the latest installer for the Windows version of Redis from here. ![]() This post is about how I started (from a point of knowing nothing about Redis or how to use it), up to the point where I was able to read and write values through a. NET applications, and I decided to try out the Redis NoSQL server. I’ve been interested in using caching to improve the performance of my. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |