예제 #1
0
        public void AddStorage(DatabaseTargetStorage storage)
        {
            if (storage == null)
            {
                return;
            }

            if (_otherStorages == null)
            {
                _otherStorages = new List <DatabaseTargetStorage>();
            }
            _otherStorages.Add(storage);
        }
예제 #2
0
        public override bool Contains(string id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(false);
            }

            if (_quickStorage != null && _quickStorage.Count != 0)
            {
                if (_quickStorage.Contains(id))
                {
                    return(true);
                }
            }
            if (_targetCache != null && _targetCache.Count != 0)
            {
                if (_targetCache.Contains(id))
                {
                    return(true);
                }
            }
            if (_targetStorage != null && _targetStorage.Count != 0)
            {
                if (_targetStorage.ContainsKey(id))
                {
                    return(true);
                }
            }
            if (_otherStorages != null && _otherStorages.Count != 0)
            {
                // We will not cache any target from the other sources, since
                // each has internal cache...
                for (int i = 0; i < _otherStorages.Count; i++)
                {
                    DatabaseTargetStorage targetStorage = _otherStorages[i];
                    if (targetStorage.Contains(id))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }