Azure Cache for Redis Toolkit

I created a collection of Azure Functions for managing the Azure Cache for Redis service, including functions to delete, add, get and flush cache entries. It’s simple to implement and use. Check it out 😉

This repository contains a collection of HTTP triggered Azure Functions for managing the Azure Cache service. The following functions are included:

  • FlushCache: Clears all entries from the cache.
  • DeleteCache: Deletes a specific entry from the cache.
  • AddtoCache: Adds a new entry to the cache.
  • GetCache: Retrieves a value from the cache.


To use these functions, you will need the following:

  • An Azure account
  • An Azure Cache service instance
  • The Azure Functions extension for Visual Studio

Getting Started

  • Clone this repository to your local machine.
  • Open the solution in Visual Studio.
  • Replace the placeholder values in the local.settings.json file with your own Azure Cache service connection.
  • Build and run the solution to test the functions locally.
  • Deploy the functions to Azure using the Azure Functions extension.
  • Add your local.settings.json parameters to your Function App Configuration(for best practices reference values from Azure KeyVault.)


To use these functions, you can call them via HTTP requests or by triggering them through other Azure services. Refer to the Azure Functions documentation for more information on how to use and trigger Azure Functions.

Example code piece for calling the AddToCache function by using RestSharp:

using RestSharp;

string connectionString;
string value;

var client = new RestClient(connectionString);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddQueryParameter("key", value);
IRestResponse response = client.Execute(request);


Using Azure Function app Configurations

Configuration in Azure Functions refers to the process of setting up and managing the various options and settings that control the behavior of your functions. These configurations can include things like connection strings for external resources, runtime settings, and application settings that your functions may need in order to run properly.

You can easily read your values from your Azure Functions app Configurations by using ConfigurationManager.cs.

        private ConfigurationManager()
            this.CacheConnection = Util.GetConfig("CacheConnection", "");
         static RedisCacheService()
            var connection = ConfigurationManager.Instance.CacheConnection;
            _connectionMultiplexer = ConnectionMultiplexer.Connect(connection);


Leave a Reply

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

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

Facebook photo

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

Connecting to %s