Remove/Delete all/one item from StackExchange.Redis cache
Remove/Delete all/one item from StackExchange.Redis cache
Remove/Delete all/one item from StackExchange.Redis cache
Re: Remove/Delete all/one item from StackExchange.Redis cache
To remove a single item:
```
_cache.KeyDelete(key);
```
To remove *all* involves the `FLUSHDB` or `FLUSHALL` redis command; both are available in StackExchange.Redis; but, [for reasons discussed here](https://stackexchange.github.io/StackExchange.Redis/KeysScan.html), they are not on the `IDatabase` API (because: they affect servers, not logical databases).
As per the "So how do I use them?" on that page:
```
server.FlushDatabase(); // to wipe a single database, 0 by default
server.FlushAllDatabases(); // to wipe all databases
```
(quite possibly after using `GetEndpoints()` on the multiplexer)
```
_cache.KeyDelete(key);
```
To remove *all* involves the `FLUSHDB` or `FLUSHALL` redis command; both are available in StackExchange.Redis; but, [for reasons discussed here](https://stackexchange.github.io/StackExchange.Redis/KeysScan.html), they are not on the `IDatabase` API (because: they affect servers, not logical databases).
As per the "So how do I use them?" on that page:
```
server.FlushDatabase(); // to wipe a single database, 0 by default
server.FlushAllDatabases(); // to wipe all databases
```
(quite possibly after using `GetEndpoints()` on the multiplexer)