Esempio n. 1
0
        private CachedResourceStatistics AddCategoryStats()
        {
            CachedResourceStatistics s = new CachedResourceStatistics()
            {
                Count       = 0,
                LastUpdated = DateTime.UtcNow, ResourceKey = KEY_CATEGORIES, BucketId = BucketId
            };

            s = this.CachedResourceStatisticsRepository.Insert(this.UserId, this.BucketId, s, true);
            return(s);
        }
Esempio n. 2
0
        public DateTime GetCategoriesLastUpdate()
        {
            if (!AllowExecute())
            {
                throw new Exception("Forbidden");
            }
            CachedResourceStatistics s = this.CachedResourceStatisticsRepository.FimdById(KEY_CATEGORIES, BucketId);

            if (s == null)
            {
                s = AddCategoryStats();
            }

            return(s.LastUpdated);
        }
Esempio n. 3
0
        public void UpdateCategoryStats()
        {
            if (!AllowExecute())
            {
                throw new Exception("Forbidden");
            }
            CachedResourceStatistics s = this.CachedResourceStatisticsRepository.FimdById(KEY_CATEGORIES, BucketId);

            if (s == null)
            {
                s = AddCategoryStats();
            }
            else
            {
                s.LastUpdated = DateTime.UtcNow;
                this.CachedResourceStatisticsRepository.Update(this.UserId, this.BucketId, s);
            }
        }