コード例 #1
0
        public InterfaceReflectionCache()
        {
            _cache = new ConcurrentCache<Type, Cache<Type, Type>>(typeKey =>
                {
                    MissingValueProvider<Type, Type> missingValueProvider = x => GetInterfaceInternal(typeKey, x);

                    return new ConcurrentCache<Type, Type>(missingValueProvider);
                });
        }
コード例 #2
0
        public TraceLogWriterFactory()
        {
            _logs = new DictionaryCache<string, TraceLogWriter>(CreateTraceLog);
            _sources = new DictionaryCache<string, TraceSource>(CreateTraceSource);

            _defaultSource = new TraceSource("Default", SourceLevels.Information);

            _listener = AddDefaultConsoleTraceListener(_defaultSource);

            _sources.Get("Topshelf");
        }
コード例 #3
0
        public TypeNameFormatter(string genericArgumentSeparator, string genericOpen, string genericClose,
            string namespaceSeparator, string nestedTypeSeparator)
        {
            _genericArgumentSeparator = genericArgumentSeparator;
            _genericOpen = genericOpen;
            _genericClose = genericClose;
            _namespaceSeparator = namespaceSeparator;
            _nestedTypeSeparator = nestedTypeSeparator;

            _cache = new ConcurrentCache<Type, string>(FormatTypeName);
        }
コード例 #4
0
ファイル: TypeNameFormatter.cs プロジェクト: haf/Internals
        public TypeNameFormatter(string genericArgumentSeparator, string genericOpen, string genericClose,
            string namespaceSeparator, string nestedTypeSeparator)
        {
            _genericArgumentSeparator = genericArgumentSeparator;
            _genericOpen = genericOpen;
            _genericClose = genericClose;
            _namespaceSeparator = namespaceSeparator;
            _nestedTypeSeparator = nestedTypeSeparator;

            #if NET35
            _cache = new ReaderWriterLockedCache<Type, string>(new DictionaryCache<Type, string>(FormatTypeName));
            #else
            _cache = new ConcurrentCache<Type, string>(FormatTypeName);
            #endif
        }
コード例 #5
0
ファイル: RouteVariablesImpl.cs プロジェクト: daffers/Magnum
		public RouteVariablesImpl(IEnumerable<RouteVariable> variables)
		{
			_values = new DictionaryCache<string, RouteVariable>(x => x.Name, variables);
		}
コード例 #6
0
ファイル: Counter.cs プロジェクト: davelondon/dontstayin
		public Counter(Cache.Create<uint> retrieveValueDelegate, string key, TimeSpan? localCacheLifespan)
		{
			this.RetrieveValue = retrieveValueDelegate;
			this.localCacheLifespan = localCacheLifespan;
			this.Key = key;
		}
コード例 #7
0
ファイル: Counter.cs プロジェクト: davelondon/dontstayin
		public Counter(Cache.Create<uint> retreiveValueDelegate, string key)
			: this(retreiveValueDelegate, key, null) { }
コード例 #8
0
 public DynamicObjectConverterCache(ImplementationBuilder implementationBuilder)
 {
     _implementationBuilder = implementationBuilder;
     _cache = new ConcurrentCache<Type, ObjectConverter>(CreateMissingConverter);
 }
コード例 #9
0
 public AnonymousObjectDictionaryConverter()
 {
     _cache = new ConcurrentCache<Type, Func<object, IDictionary<string, object>>>(CreateObjectToDictionaryConverter);
     _default = new Dictionary<string, object>();
 }
コード例 #10
0
ファイル: RouteParametersImpl.cs プロジェクト: daffers/Magnum
		public RouteParametersImpl(IEnumerable<RouteParameter> parameters)
		{
			_values = new DictionaryCache<string, RouteParameter>(x => x.Name, parameters);
		}
コード例 #11
0
 public DictionaryConverterCache()
 {
     _cache = new GenericTypeCache<DictionaryConverter>(typeof(ObjectDictionaryConverter<>),
         CreateMissingConverter);
 }
コード例 #12
0
		public static uint GetCounter(this ICounterStore counterStore, CacheKey key, Cache.Create<uint> create)
		{
			return counterStore.GetCounter(key.ToString(), create);
		}
コード例 #13
0
		public static uint Increment(this ICounterStore counterStore, CacheKey cacheKey, Cache.Create<uint> create)
		{
			return counterStore.Increment(cacheKey.ToString(), create);
		}
コード例 #14
0
        static InstanceBinderContext()
        {
            _typeBinders = new GenericTypeCache<ObjectBinder>(typeof(ObjectBinder<>), CreateBinderFor);

            LoadBuiltInBinders();
        }