Ejemplo n.º 1
0
 public static IElementRepository GetElementRepository(Site site)
 {
     var repository = site.ObjectCache().Get(cacheKey);
     if (repository == null)
     {
         repository = new Kooboo.Globalization.Repository.CacheElementRepository(() => Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve<IElementRepositoryFactory>().CreateRepository(site));
         site.ObjectCache().Add(cacheKey, repository, new System.Runtime.Caching.CacheItemPolicy()
         {
             SlidingExpiration = TimeSpan.Parse("00:30:00")
         });
     }
     return (IElementRepository)repository;
 }
Ejemplo n.º 2
0
 public static IElementRepository GetElementRepository(Site site)
 {
     var repository = site.ObjectCache().Get(cacheKey);
     if (repository == null)
     {
         repository = new Kooboo.Globalization.Repository.CacheElementRepository(DefaultRepositoryFactory.Instance.CreateRepository(site));
         site.ObjectCache().Add(cacheKey, repository, new System.Runtime.Caching.CacheItemPolicy()
         {
             SlidingExpiration = TimeSpan.Parse("00:30:00")
         });
     }
     return (IElementRepository)repository;
 }
Ejemplo n.º 3
0
        public static IElementRepository GetElementRepository(Site site)
        {
            var repository = site.ObjectCache().Get(cacheKey);

            if (repository == null)
            {
                repository = new Kooboo.Globalization.Repository.CacheElementRepository(() => Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <IElementRepositoryFactory>().CreateRepository(site));
                site.ObjectCache().Add(cacheKey, repository, new System.Runtime.Caching.CacheItemPolicy()
                {
                    SlidingExpiration = TimeSpan.Parse("00:30:00")
                });
            }
            return((IElementRepository)repository);
        }
Ejemplo n.º 4
0
        public static IElementRepository GetElementRepository(Site site)
        {
            var repository = site.ObjectCache().Get(cacheKey);

            if (repository == null)
            {
                repository = new Kooboo.Globalization.Repository.CacheElementRepository(DefaultRepositoryFactory.Instance.CreateRepository(site));
                site.ObjectCache().Add(cacheKey, repository, new System.Runtime.Caching.CacheItemPolicy()
                {
                    SlidingExpiration = TimeSpan.Parse("00:30:00")
                });
            }
            return((IElementRepository)repository);
        }