Azure Redis Commands

Now that we have created our Redis Cache lets connect to it. You can use the most common tool redis cli.exe https://redis.io/download or as I am going to do, use the Azure Portal to use the console directly, this isn’t probably the best way but it’s the easiest for this blog. 2 key points here:

When your cache is part of a VNET, only clients in the VNET can access the cache. Because Redis Console runs in your local browser, which is outside the VNET, it can’t connect to your cache.

Not all Redis commands are supported in Azure Cache for Redis.

  • BGREWRITEAOF
  • BGSAVE
  • CONFIG
  • DEBUG
  • MIGRATE
  • SAVE
  • SHUTDOWN
  • SLAVEOF
  • REPLICAOF
  • ACL
  • CLUSTER 

Back in Azure right at the top of your Redis page you will see console.

Click it and take note of the warning, don’t get over excited running heavy commands in production.

First command : INFO

Lets set and retrieve a key.

SET mainkey “alpha123”

GET mainkey

What about setting a key and expiring it? Here I set this to 100 and after 12 seconds I want to expire it. First time I run get was within 3 seconds thus returned the value, another 10 seconds later NULL.

Obviously, you will want to hook up your web apps to Redis, this was just showing you how to connect to the console.

1 thought on “Azure Redis Commands

  1. Pingback: Making Redis Do Your Bidding – Curated SQL

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s