下面是Nop裡面的程式碼你可以參考下
///
/// Removes items by pattern
/// pattern
public virtual void RemoveByPattern(string pattern)
{
var _muxer = RedisManager.GetMuxer();
var _db = RedisManager.GetDb();
foreach (var ep in _muxer.GetEndPoints())
var server = _muxer.GetServer(ep);
var keys = server.Keys(pattern: "*" + pattern + "*", database: _db.Database);
foreach (var key in keys)
_db.KeyDelete(key);
}
下面是Nop裡面的程式碼你可以參考下
///
/// Removes items by pattern
///
/// pattern
public virtual void RemoveByPattern(string pattern)
{
var _muxer = RedisManager.GetMuxer();
var _db = RedisManager.GetDb();
foreach (var ep in _muxer.GetEndPoints())
{
var server = _muxer.GetServer(ep);
var keys = server.Keys(pattern: "*" + pattern + "*", database: _db.Database);
foreach (var key in keys)
_db.KeyDelete(key);
}
}