Redis cache : value is not persistent, getting high number of request on AzureConfigStore.

Y-3370 20 Reputation points
2024-04-11T11:53:08.09+00:00
  • Key's value not found while reading it from Redis cache sometimes, due to which Azure Config Store receiving high number of request.
  • No error getting logged on application insights while reading the value from redis cache. Sometimes value is fetched from the cache and sometimes call to azure config store is made to read the value from config store instead of fetching it from cache. However expiration date for key is set after next 12 hours.
  • TTL is set 12 hours.

Dim objCache As IDatabase = Connection.GetDatabase()

    Dim cacheObject = objCache.StringGet(GetCacheKey(key))

    Dim localCache As Cache

    If cacheObject.HasValue Then

        localCache = FromByteArray(Of Cache)(cacheObject)

        If localCache IsNot Nothing Then

            localCache.Value = value

            localCache.ExpirationDateTime = DateTime.Now.AddHours(12)

        End If

    Else

        localCache = New Cache With {

            .ExpirationDateTime = DateTime.Now.AddHours(12),

            .Key = key,

            .Value = value

    objCache.StringSet(GetCacheKey(key), ToByteArray(Of Cache)(localCache))
Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
216 questions
{count} votes