/// <summary> /// This method is called by ASP.NET system on web application's startup. /// </summary> protected virtual void Application_Start(object sender, EventArgs e) { AbpBootstrapper.IocManager.RegisterIfNot <IAssemblyFinder, WebAssemblyFinder>(); //var cache = new ThreadSafeObjectCache<object>(new MemoryCache("_AbpWebApplicationCache"), TimeSpan.FromHours(3)); var cache = new AbpMemoryCache("_AbpWebApplicationCache") { DefaultSlidingExpireTime = TimeSpan.FromDays(1) }; //AbpBootstrapper.IocManager.IocContainer.Register( // Component.For<ThreadSafeObjectCache<object>>().Named("_AbpBootstrapper").Instance(cache).LifestyleTransient()); AbpBootstrapper.IocManager.IocContainer.Register( Component.For <AbpMemoryCache>().Named("_AbpBootstrapper").Instance(cache).LifestyleTransient() ); AbpBootstrapper.Initialize(); //为了能够使用AntiForgeryToken,该处配置是必须的 AntiForgeryConfig.UniqueClaimTypeIdentifier = AbpClaimTypes.UserIdClaimType; }
public AbpMemoryCache_Tests() { _memoryCache = new AbpMemoryCache("test cache"); }