public void Remove(IObjectAssemblySpecification ireg) { IObjectAssemblerRegistrationKey key = MakeKey(ireg.Name, ireg.ResolvesTo); typeRegistrations.Remove(key); ireg.FlushCache(); }
public void FlushCache(IObjectAssemblySpecification registration) { if (_localStorage == null) { return; } _localStorage.Remove(registration.Key); }
public void FlushCache(IObjectAssemblySpecification registration) { var reg = registration as ObjectAssemblySpecification; if (reg != null) { reg._instance = null; } }
public object ActivateInstance(IObjectAssemblySpecification registration) { Cache cache = HttpRuntime.Cache; string key = registration.Key; object instance = cache[key]; if (instance == null) { lock (_syncRoot) { instance = cache[key]; if (instance == null) { instance = registration.CreateInstance(); if (_expirationTime == Cache.NoAbsoluteExpiration && _expirationDuration == Cache.NoSlidingExpiration) { _expirationBehavior = CachedItemExpirationBehavior.NeverExpires; } switch (_expirationBehavior) { case CachedItemExpirationBehavior.NeverExpires: cache.Insert(key, instance, _dependencies, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, _cachePriority, _onRemoveCallback); break; case CachedItemExpirationBehavior.AtScheduledDate: cache.Insert(key, instance, _dependencies, _expirationTime, Cache.NoSlidingExpiration, _cachePriority, _onRemoveCallback); break; case CachedItemExpirationBehavior.AfterTimeSpan: cache.Insert(key, instance, _dependencies, DateTime.UtcNow.Add(_expirationDuration), Cache.NoSlidingExpiration, _cachePriority, _onRemoveCallback); break; case CachedItemExpirationBehavior.AfterNotUsedInTimeSpan: cache.Insert(key, instance, _dependencies, Cache.NoAbsoluteExpiration, _expirationDuration, _cachePriority, _onRemoveCallback); break; } } } } return(instance); }
public object ActivateInstance(IObjectAssemblySpecification creator) { object instance = null; if (_localStorage == null) { _localStorage = new Dictionary <string, object>(); } if (!_localStorage.TryGetValue(creator.Key, out instance)) { instance = creator.CreateInstance(); _localStorage[creator.Key] = instance; } return(instance); }
public object ActivateInstance(IObjectAssemblySpecification registration) { object instance; if (!RequestLifetimeInstances.TryGetValue(registration.Key, out instance)) { lock (_lock) { if (!RequestLifetimeInstances.TryGetValue(registration.Key, out instance)) { instance = registration.CreateInstance(); RequestLifetimeInstances[registration.Key] = instance; } } } return(instance); }
public object ActivateInstance(IObjectAssemblySpecification registration) { object instance = Session[registration.Key]; if (instance == null) { lock (_syncLock) { instance = Session[registration.Key]; if (instance == null) { instance = registration.CreateInstance(); Session[registration.Key] = instance; } } } return(instance); }
public object ActivateInstance(IObjectAssemblySpecification registration) { string key = registration.Key; CachedInstance ci = null; if (_cache.TryGetValue(key, out ci)) { lock (_syncLock) ci.LastCacheHit = DateTime.UtcNow; } else { ci = new CachedInstance { Instance = registration.CreateInstance(), LastCacheHit = DateTime.UtcNow }; _cache.TryAdd(key, ci); } MaybeGroomCache(); return(ci.Instance); }
public void FlushCache(IObjectAssemblySpecification registration) { Session.Remove(registration.Key); }
public void Remove(IObjectAssemblySpecification ireg) { _typeRegistry.Remove(ireg); }
public object ActivateInstance(IObjectAssemblySpecification registration) { return(registration.CreateInstance()); }
public object ActivateInstance(IObjectAssemblySpecification registration) { return(((ObjectAssemblySpecification)registration).ProvisionInstanceFromCache()); }
public static IObjectAssemblySpecification AsSessionSingleton(this IObjectAssemblySpecification reg) { return(reg.WithInstanceCreationStrategy(_httpSessionInstanceFactory)); }
public static IObjectAssemblySpecification AsWebCached(this IObjectAssemblySpecification reg) { return(reg.WithInstanceCreationStrategy(_webCachedInstanceFactory)); }
public void FlushCache(IObjectAssemblySpecification registration) { CachedInstance _ = null; _cache.TryRemove(registration.Key, out _); }
public void FlushCache(IObjectAssemblySpecification registration) { Cache cache = HttpRuntime.Cache; cache.Remove(registration.Key); }
public void FlushCache(IObjectAssemblySpecification registration) { RequestLifetimeInstances.Remove(registration.Key); }
public static IObjectAssemblySpecification AsInstanceCacheInstance(this IObjectAssemblySpecification reg) { return(reg.WithInstanceCreationStrategy(_instanceCacheFactory)); }
public static IObjectAssemblySpecification AsThreadSingleton(this IObjectAssemblySpecification reg) { return(reg.WithInstanceCreationStrategy(_threadLocalInstanceFactory)); }
public static IObjectAssemblySpecification AsAlwaysNew(this IObjectAssemblySpecification reg) { return(reg.WithInstanceCreationStrategy(null)); }
public void FlushCache(IObjectAssemblySpecification registration) { }