public InterfaceReflectionCache()
        {
            _cache = new ConcurrentCache<Type, Cache<Type, Type>>(typeKey =>
                {
                    MissingValueProvider<Type, Type> missingValueProvider = x => GetInterfaceInternal(typeKey, x);

                    return new ConcurrentCache<Type, Type>(missingValueProvider);
                });
        }
        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");
        }
        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);
        }
Beispiel #4
0
        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
        }
Beispiel #5
0
		public RouteVariablesImpl(IEnumerable<RouteVariable> variables)
		{
			_values = new DictionaryCache<string, RouteVariable>(x => x.Name, variables);
		}
Beispiel #6
0
		public Counter(Cache.Create<uint> retrieveValueDelegate, string key, TimeSpan? localCacheLifespan)
		{
			this.RetrieveValue = retrieveValueDelegate;
			this.localCacheLifespan = localCacheLifespan;
			this.Key = key;
		}
Beispiel #7
0
		public Counter(Cache.Create<uint> retreiveValueDelegate, string key)
			: this(retreiveValueDelegate, key, null) { }
 public DynamicObjectConverterCache(ImplementationBuilder implementationBuilder)
 {
     _implementationBuilder = implementationBuilder;
     _cache = new ConcurrentCache<Type, ObjectConverter>(CreateMissingConverter);
 }
 public AnonymousObjectDictionaryConverter()
 {
     _cache = new ConcurrentCache<Type, Func<object, IDictionary<string, object>>>(CreateObjectToDictionaryConverter);
     _default = new Dictionary<string, object>();
 }
Beispiel #10
0
		public RouteParametersImpl(IEnumerable<RouteParameter> parameters)
		{
			_values = new DictionaryCache<string, RouteParameter>(x => x.Name, parameters);
		}
 public DictionaryConverterCache()
 {
     _cache = new GenericTypeCache<DictionaryConverter>(typeof(ObjectDictionaryConverter<>),
         CreateMissingConverter);
 }
Beispiel #12
0
		public static uint GetCounter(this ICounterStore counterStore, CacheKey key, Cache.Create<uint> create)
		{
			return counterStore.GetCounter(key.ToString(), create);
		}
Beispiel #13
0
		public static uint Increment(this ICounterStore counterStore, CacheKey cacheKey, Cache.Create<uint> create)
		{
			return counterStore.Increment(cacheKey.ToString(), create);
		}
Beispiel #14
0
        static InstanceBinderContext()
        {
            _typeBinders = new GenericTypeCache<ObjectBinder>(typeof(ObjectBinder<>), CreateBinderFor);

            LoadBuiltInBinders();
        }