Fred Johnson
Fred Johnson

Reputation: 2695

Where is the correct place to store ConnectionMultiplexer in stackexchange redis

Is there a potential issue with storing it as a static variable in my utilities and accessing it anywhere or should using statements be used?

I'm assuming the latter, much like a data context but if it's more efficient to use the initial, since I want the connection to pretty much always be open I'd just like to draw on others experience.

Thanks

Upvotes: 0

Views: 669

Answers (1)

genichm
genichm

Reputation: 535

I am storing multiplexer in static variable and did not ancountered any problem. Based on creators document https://github.com/StackExchange/StackExchange.Redis/blob/master/Docs/Basics.md it is not recommended to use using statement cause multiplexer designed to be reused. Find it in beggining of the document. Hope it will help.

Upvotes: 2

Related Questions