Example #1
0
        private Sid GetSidFromCache(string role)
        {
            Sid sid = null;

            if (s_sidCache != null)
            {
                lock (s_cacheLock)
                {
                    Sid cachedsid = (Sid)s_sidCache[role.ToUpper()];
                    if (cachedsid != null)
                    {
                        sid = cachedsid.Copy();
                    }
                }
            }
            return(sid);
        }
Example #2
0
        private void AddSidToCache(string role, Sid sid)
        {
            if (s_sidCache == null)
            {
                lock (s_cacheLock)
                {
                    if (s_sidCache == null)
                    {
                        s_sidCache = new SidCache();
                    }
                }
            }

            lock (s_cacheLock)
            {
                if (!s_sidCache.Contains(role))
                {
                    s_sidCache.Add(role.ToUpper(), sid.Copy());
                }
            }
        }