private void AddRecentlyUpdatingUsers(Security.IdentityInfo identity, TKey key)
 {
     if (identity != null && identity.Id > 0)
     {
         AddRecentlyUpdatingUsers(identity.Id, key);
     }
 }
        private void AddRecentlyUpdatingUsers(Security.IdentityInfo identity, IEnumerable <TKey> keys)
        {
            if (identity != null && identity.Id > 0)
            {
                long userId = identity.Id;

                foreach (var key in keys)
                {
                    AddRecentlyUpdatingUsers(userId, key);
                }
            }
        }
        bool BypassRecentCache(TKey keyToBypass, Security.IdentityInfo identity)
        {
            if (identity == null)
            {
                return(false);
            }

            var userId = identity.Id;

            if (userId == 0)
            {
                return(false);
            }

            var recentUpdateKey = new Tuple <long, TKey>(userId, keyToBypass);

            return(_recentUpdatingUsers.ContainsKey(recentUpdateKey));
        }