如何使用c#在stackexchange redis客户端上执行flush命令

时间:2014-08-01 07:11:52

标签: c# stackexchange.redis

我们如何使用stackexchange redis客户端来执行FlushAll和FlushDB redis命令?

1 个答案:

答案 0 :(得分:6)

project homepage有一个Documentation section,其中包含Where are KEYS, SCAN, FLUSHDB etc?

简短的回答是:通过IServer。该文档包括"为什么"。

// get the target server
var server = conn.GetServer(someServer);

// completely wipe ALL keys from database 0
server.FlushDatabase(); // database number is optional and defaults to 0