You can do as the following to batch delete items from redis cache. (StackExchange.Redis.StrongName v1.0.488)
foreach (var ep in _muxer.GetEndPoints())
{
var server = _muxer.GetServer(ep);
var keys = server.Keys(database: _redisDatabase, pattern: pattern + "*").ToArray();
_db.KeyDeleteAsync(keys);
}
_muxer
is instance of ConnectionMultiplexer
It does not delete by pattern as you asked but much faster than deleting each key separately.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…