Exemple #1
0
 public LanguageRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
     : base(work, cache, logger, sqlSyntax)
 {
     //Custom cache options for better performance
     _cacheOptions = new RepositoryCacheOptions
     {
         GetAllCacheAllowZeroCount = true,
         GetAllCacheValidateCount  = false
     };
 }
 public PublicAccessRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax)
     : base(work, cache, logger, sqlSyntax)
 {
     _options = new RepositoryCacheOptions
     {
         //We want to ensure that a zero count gets cached, even if there is nothing in the db we don't want it to lookup nothing each time
         GetAllCacheAllowZeroCount = true,
         //Set to 1000 just to ensure that all of them are cached, The GetAll on this repository gets called *A lot*, we want max performance
         GetAllCacheThresholdLimit = 1000,
         //Override to false so that a Count check against the db is NOT performed when doing a GetAll without params, we just want to
         // return the raw cache without validation. The GetAll on this repository gets called *A lot*, we want max performance
         GetAllCacheValidateCount = false
     };
 }
Exemple #3
0
        internal TemplateRepository(IDatabaseUnitOfWork work, CacheHelper cache, ILogger logger, ISqlSyntaxProvider sqlSyntax, IFileSystem masterpageFileSystem, IFileSystem viewFileSystem, ITemplatesSection templateConfig)
            : base(work, cache, logger, sqlSyntax)
        {
            _masterpagesFileSystem = masterpageFileSystem;
            _viewsFileSystem       = viewFileSystem;
            _templateConfig        = templateConfig;
            _viewHelper            = new ViewHelper(_viewsFileSystem);
            _masterPageHelper      = new MasterPageHelper(_masterpagesFileSystem);

            _cacheOptions = new RepositoryCacheOptions
            {
                //Allow a zero count cache entry because GetAll() gets used quite a lot and we want to ensure
                // if there are no templates, that it doesn't keep going to the db.
                GetAllCacheAllowZeroCount = true,
                //GetAll gets called a lot, we want to ensure that all templates are in the cache, default is 100 which
                // would normally be fine but we'll increase it in case people have a ton of templates.
                GetAllCacheThresholdLimit = 500
            };
        }