Пример #1
0
        public void Remove(string key)
        {
            _Config.Remove(_UserPrefix + key);

            if (!IsCaching)
            {
                return;
            }
            if (key.EndsWith("/"))
            {
                // invalidate all cache keys of this section
                var cachedKeys = new List <string>();
                foreach (string cacheKey in _Cache.Keys)
                {
                    if (cacheKey.StartsWith(key))
                    {
                        cachedKeys.Add(cacheKey);
                    }
                }
                foreach (string cacheKey in cachedKeys)
                {
                    _Cache.Remove(cacheKey);
                }
            }
            else
            {
                // deleting the single entry is enough
                _Cache.Remove(key);
            }
        }
Пример #2
0
        public void DeleteUser(string username)
        {
            if (username == null)
            {
                throw new ArgumentNullException("username");
            }

            CheckUsername(username);
            CheckUserExists(username);

            List <string> userList = GetUsers();

            userList.Remove(username);
            f_Config[f_Prefix + "/Users"] = userList.ToArray();
            f_Config.Remove(f_Prefix + "/" + username + "/");
        }