private bool IsExpired(CacheEntry entry)
        {
            if (this.ttl == null)
            {
                return false;
            }

            return (DateTimeOffset.UtcNow - entry.CreatedAt) > this.ttl.Value;
        }
        Map ISynchronousCache.Put(string key, Map value)
        {
            try
            {
                var db = this.connection.GetDatabase();

                var cacheKey = this.ConstructKey(key);
                var cacheData = this.serializer.Serialize(value);

                var entry = new CacheEntry(
                    cacheData,
                    DateTimeOffset.UtcNow);

                db.StringSet(cacheKey, entry.ToString(), this.tti);
            }
            catch (Exception e)
            {
                this.logger.Error(e, "Error while storing value in cache.", "RedisSyncCache.Put");
            }

            return value;
        }
#pragma warning restore CS4014

        async Task<Map> IAsynchronousCache.PutAsync(string key, Map value, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            try
            {
                var db = this.connection.GetDatabase();

                var cacheKey = this.ConstructKey(key);
                var cacheData = this.serializer.Serialize((Map)value);

                var entry = new CacheEntry(
                    cacheData,
                    DateTimeOffset.UtcNow);

                await db.StringSetAsync(cacheKey, entry.ToString(), this.tti).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                this.logger.Error(e, "Error while storing value in cache.", "RedisAsyncCache.PutAsync");
            }

            return value;
        }