public static ThrottlerItem Get(ThrottlerItem throttlerItem) { if (throttlerItem == null) { return(default(ThrottlerItem)); } var key = throttlerItem.GenerateKey(); if (_cache.TryGetValue(key, out ThrottlerItem stored)) { return(stored); } return(throttlerItem); }
public static void Set(ThrottlerItem throttlerItem) { var key = throttlerItem.GenerateKey(); _cache.AddOrUpdate(key, throttlerItem, (key, oldValue) => oldValue = throttlerItem); }
public static void Remove(ThrottlerItem throttlerItem) { var key = throttlerItem.GenerateKey(); _cache.TryRemove(key, out ThrottlerItem stored); }