Пример #1
0
        /// <summary>
        /// Updates the home page item in the cache.
        /// </summary>
        /// <param name="item">The updated homepage item.</param>
        public void UpdateHomePage(PageViewModel item)
        {
            if (!_applicationSettings.UseObjectCache)
            {
                return;
            }

            _cache.Remove(CacheKeys.HomepageKey());
            _cache.Add(CacheKeys.HomepageKey(), item, new CacheItemPolicy());
        }
Пример #2
0
        /// <summary>
        /// Retrieves the home page item from the cache, or null if it doesn't exist.
        /// </summary>
        /// <returns>The cached <see cref="PageViewModel"/> for the homepage; or null if it doesn't exist.</returns>
        public PageViewModel GetHomePage()
        {
            if (!_applicationSettings.UseObjectCache)
            {
                return(null);
            }

            Log("Get latest homepage");

            return(_cache.Get(CacheKeys.HomepageKey()) as PageViewModel);
        }
Пример #3
0
        /// <summary>
        /// Removes the home page item from the cache if it exists.
        /// </summary>
        public void RemoveHomePage()
        {
            if (!_applicationSettings.UseObjectCache)
            {
                return;
            }

            _cache.Remove(CacheKeys.HomepageKey());

            Log("Removed homepage from cache", CacheKeys.HomepageKey());
        }