■ ConnectionMultiplexer 클래스를 사용해 재사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
using System; using System.Threading; using StackExchange.Redis; Lazy<ConnectionMultiplexer> multiplexerLazy = new Lazy<ConnectionMultiplexer> ( () => ConnectionMultiplexer.Connect("192.168.29.197:6380"), LazyThreadSafetyMode.ExecutionAndPublication ); IDatabase database1 = multiplexerLazy.Value.GetDatabase(1); IDatabase database2 = multiplexerLazy.Value.GetDatabase(2); |
※ 패키지 설치 : StackExchange.Redis