src/ZKEACMS/Page/EventHandler/RemoveCacheOnPageUrlChangedEventHandler.cs

(完整代码) 1KB

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Easy.Cache;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using ZKEACMS.Event;
using ZKEACMS.Widget;

namespace ZKEACMS.Page
{
    public class RemoveCacheOnPageUrlChangedEventHandler : IEventHandler
    {
        private readonly ICacheManager<IEnumerable<WidgetBase>> _pageWidgetCacheManager;
        private readonly ICacheManager<ConcurrentDictionary<string, object>> _concurrentCacheManager;

        public RemoveCacheOnPageUrlChangedEventHandler(ICacheManager<IEnumerable<WidgetBase>> pageWidgetCacheManage, 
            ICacheManager<ConcurrentDictionary<string, object>> concurrentCacheManager)
        {
            _pageWidgetCacheManager = pageWidgetCacheManage;
            _concurrentCacheManager = concurrentCacheManager;
        }

        public void Handle(object entity, EventArg e)
        {
            PageEntity page = entity as PageEntity;
            if (page != null && e.Data != null)
            {
                _pageWidgetCacheManager.Clear();
                _concurrentCacheManager.Clear();
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。