我想从我的 Redis 中删除所有匹配 SomePrefix* 的键。可能吗 ?我在库中只看到 m_connectionMultiplexer.GetDatabase().KeyDelete() 而不是 KeyMatch() 或 GetAllKeys()。
最好不要 Lua 脚本,例如Leonid Beschastny 的链接
我想在 Web 应用程序的初始化中使用它来获取应用程序的开发状态。
我想从我的 Redis 中删除所有匹配 SomePrefix* 的键。可能吗 ?我在库中只看到 m_connectionMultiplexer.GetDatabase().KeyDelete() 而不是 KeyMatch() 或 GetAllKeys()。
最好不要 Lua 脚本,例如Leonid Beschastny 的链接
我想在 Web 应用程序的初始化中使用它来获取应用程序的开发状态。
SE.Redis directly mimics the features exposed by the server. The server does not have a "delete keys matching this pattern" feature. It does have "scan for keys matching this pattern" (via GetServer().GetKeys(...)
), and it has "delete this key / these keys" (via GetDatabase.KeyDelete(...)
). You could iterate in batches over the matching keys, deleting each batch in turn. Because you can pipeline requests, you don't pay latency per batch.
As an alternative implementation: partition the data by numeric database (select
) or server, and use flushdb
/ flush
.