Recently, I’ve been looking into how to improve the performance and scalability of ASP.NET Core web APIs. One strategy for doing this is caching data in a Redis server. Redis is popular open source key-value store that is often used for caching.
In this post, we’ll briefly cover how to get started with redis on windows.
For the installer, head to the latest windows redis release, download and run the latest MSI.
I’d recommend ticking the box to add redis to the PATH variable to make interacting with redis from the command line easier:
Also, take note of the port that redis will run on:
Let’s quickly check it’s installed and running ok by testing it in the CLI:
We can also install Redis Desktop Manager which is a GUI management tool for Redis.
After we have installed redis desktop manager, we can connect to our redis server.
We can then see the key and value we set earlier in the redis CLI:
We can edit the value:
As you would expect, you can add new key-values as well
- Redis is super fast - according to the docs, it can potentially perform up to 120,000 requests per second
- Redis is very simple - you can store data with just a single
setcommand and retrieve the data using the
getcommand. There’s no defining of any tables etc
- Redis is durable - it can write the data to disk …
- Redis works on multiple platforms and many languages - including windows and ASP.NET Core!
We’ll wire a redis cache up to an ASP.NET Core web API in a future post …
Did you find this post useful?Let me know by sharing it on Twitter.
If you to learn about using React with ASP.NET Core you might find my book useful: