Follow along as I implement DynamoDB Single-Table Design - find out the tools and methods I use to make the process easier, and finally the light-bulb moment...
- clearing your Redis Cache involves logging in to a server containing your Redis instance and running a few Redis commands to flush the cache
- it doesn’t matter if you have your own server with a Redis cache installation, or hosted in the Cloud like in AWS Elasticache or Azure Cache for Redis, you can login just the same
- there is a tool redis-cli available, but what if you don’t want to build it yourself, or you simply can’t, also this tool is only available in Linux, in this situation, we want to be able to do it from a Windows machine
- there is a Linux networking utility called Netcat that can easily remotely connect to servers. There is also a port of this for Windows which we use in this post
- so first you connect to your Redis cache with:
nc <ipaddress of redis server> <port of redis server> // once connected, run the following Redis commands SELECT 0 // specify your Redis index here +OK // Redis reply FLUSHDB // now flush that DB index +OK // Redis reply QUIT // and then disconnect +OK // Redis reply
Now that’s nice, however it is not clear what you need to do if you want to do this operation remotely from a Windows machine and plug it into your CI/CD system.
- Powershell to the rescue!
Here is the Powershell script
It is surprisingly simple and can be done in a couple of lines of Powershell.
$redisCommands = "SELECT $redisDBIndex`r`nFLUSHDB`r`nQUIT`r`n" $redisCommands | .\nc $redisServer 6379
In the first line, we are setting up the 3 Redis commands, but separating them in it’s own line (crlf). Because we are in Powershell we have the pipe (|) operator to make things easy. We simply pipe the commands to nc.
As simple as that.
Use DynamoDB as it was intended, now!
A GraphQL web client in ReactJS and Apollo
From source to cloud using Serverless and Github Actions
How GraphQL promotes thoughtful software development practices
Why you might not need external state management libraries anymore
My thoughts on the AWS Certified Developer - Associate Exam, is it worth the effort?
Running Lighthouse on this blog to identify opportunities for improvement
Use the power of influence to move people even without a title
Real world case studies on effects of improving website performance
Speeding up your site is easy if you know what to focus on. Follow along as I explore the performance optimization maze, and find 3 awesome tips inside (plus...
Tools for identifying performance gaps and formulating your performance budget
Why web performance matters and what that means to your bottom line
How to easily clear your Redis cache remotely from a Windows machine with Powershell
Trials with Docker and Umbraco for building a portable development environment, plus find 4 handy tips inside!
How to create a low cost, highly available CDN solution for your image handling needs in no time at all.
What is the BFF pattern and why you need it.