Last time we saw how to change database connection string for Sitefinity which can be useful if we need to extract it in runtime. In the same manner we can enable Redis which is required when running Sitefinity in Azure (and is not needed on developer machine). First, add code to AssemblyInfo.cs:

// Sitefinity version: 10.0.6411.0
// Override configuration files
[assembly: PreApplicationStartMethod(typeof(LoadBalancerConfiguration), "OverrideConnectionString")]

And now modify file SystemConfig.config with Redis settings:

using System.IO;
using System.Web.Hosting;
using System.Xml.Linq;

namespace Cms
{
	public class LoadBalancerConfiguration
    {
		public static void OverrideConnectionString()
		{
			var configurationFilePath = HostingEnvironment.MapPath("~/App_Data/Sitefinity/Configuration/SystemConfig.config");

			if (string.IsNullOrEmpty(config.RedisConnectionString))
			{
				return;
			}

			var document = XDocument.Load(configurationFilePath);

			var systemConfig = document.Element("systemConfig");
			var loadBalancingConfig = systemConfig.Element("loadBalancingConfig");
			if (loadBalancingConfig == null)
			{
				loadBalancingConfig = new XElement("loadBalancingConfig");
				systemConfig.Add(loadBalancingConfig);
			}

			var redisSettings = loadBalancingConfig.Element("redisSettings");
			if (redisSettings == null)
			{
				redisSettings = new XElement("redisSettings");
				loadBalancingConfig.Add(redisSettings);
			}

			var connectionString = redisSettings.Attribute("ConnectionString");
			if (connectionString == null)
			{
				connectionString = new XAttribute("ConnectionString", "");
				redisSettings.Add(connectionString);
			}

			connectionString.Value = "YOUR_CONNECTION_STRING";

			File.WriteAllText(configurationFilePath, document.ToString());
		}
	}
}

Tested with Sitefinity version: 10.0.6411.0.