Пример #1
0
        protected virtual void SetDefaultOptions()
        {
            CacheName = CacheNameAttribute.GetCacheName(typeof(TCacheItem));

            //IgnoreMultiTenancy
            IgnoreMultiTenancy = typeof(TCacheItem).IsDefined(typeof(IgnoreMultiTenancyAttribute), true);

            //Configure default cache entry options
            DefaultCacheOptions = GetDefaultCacheEntryOptions();
        }
Пример #2
0
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            Configure <AbpDistributedCacheOptions>(option =>
            {
                option.CacheConfigurators.Add(cacheName =>
                {
                    if (cacheName == CacheNameAttribute.GetCacheName(typeof(Sail.Testing.Caching.PersonCacheItem)))
                    {
                        return(new DistributedCacheEntryOptions()
                        {
                            AbsoluteExpiration = DateTime.Parse("2099-01-01 12:00:00")
                        });
                    }

                    return(null);
                });

                option.GlobalCacheEntryOptions.SetSlidingExpiration(TimeSpan.FromMinutes(20));
            });
        }