Redis distributed increment with locking
问题 I have a requirement for generating an counter which will be send to some api calls. My application is running on multiple node so some how I wanted to generate unique counter. I have tried following code public static long GetTransactionCountForUser(int telcoId) { long valreturn = 0; string key = "TelcoId:" + telcoId + ":Sequence"; if (Muxer != null && Muxer.IsConnected && (Muxer.GetDatabase()) != null) { IDatabase db = Muxer.GetDatabase(); var val = db.StringGet(key); int maxVal = 999; if