What is the correct lifecycle management of the ConnectionMultiplexer instance in a web scenario. As I understand it manages individual requests by pipelining them and thus reduces the negative effect caused by latency. Does that mean that in a web application the ConnectionMultiplexer should be used as a singleton as opposed to the more frequently used request scope?
Essentially, yes - you should rarely need more than one multiplexer to the same Redis nodes. This is also described here. Note that the database object from GetDatabase is very cheap, and can be per request or per method-scope if needed (per-rewuest plays very nicely for multi-tenancy scenarios where different tenants are on different database numbers)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With