RedisRequestLogger doesn't delete request log entries from redis cache

The keys for the request log entries are stored in a sorted set.

Keys are removed from the set when it reaches full capacity, but the request log entries themselves are never removed. This results in redis eventually filling up all available memory with request log entries.

The keys that are removed from the sorted set need to be removed from the database also.

var key = UrnId.Create<RequestLogEntry>(entry.Id).ToLower();
var nowScore = DateTime.UtcNow.ToUnixTime();

using (var trans = redis.CreateTransaction())
{
    trans.QueueCommand(r => r.AddItemToSortedSet(SortedSetKey, key, nowScore));
    trans.QueueCommand(r => r.Store(entry));

    if (loggerCapacity != null)
    {
        //entry itself is not removed from redis???
        trans.QueueCommand(r => r.RemoveRangeFromSortedSet(SortedSetKey, 0, -loggerCapacity.Value - 1));
    }

    trans.Commit();
}

Ouch that’s not ideal behavior for a rolling log :smile: - should now be resolved in this commit.

This change is available from v4.0.55 that’s now available on MyGet.