Exemple #1
0
        public object Read(Type baseType, string path, object defaultValue)
        {
            if (!_keyToValue.TryGetValue(path, out LazyVar <object> value))
            {
                _keyToValue[path] = new LazyVar <object>(_cacheInterval, () => ReadNonCached(baseType, path, defaultValue));
            }

            return(_keyToValue[path].GetValue());
        }
Exemple #2
0
        public object Read(Type baseType, string path, object defaultValue, bool decrypt)
        {
            //although it is not safe to cache decrypted values, its good enough for my use case ;)
            if (!_keyToValue.TryGetValue(path, out LazyVar <object> value))
            {
                _keyToValue[path] = new LazyVar <object>(_cacheInterval, () => ReadNonCached(baseType, path, defaultValue, decrypt));
            }

            return(_keyToValue[path].GetValue());
        }