資源簡介
開發WEB管理系統時,我們都希望有一套底層框架,把界面都設計好,并且后臺程序架構也搭建好,這樣只需要在此基礎上開發我們自己的業務流程就可以輕松實現管理系統。這個框架就實現了這個需要,前端利用bootstrap實現界面,與后臺通過ajax交換數據。后臺代碼.net mvc控制器調用service服務層,service層調用dao層,而dao層是封裝dapper的一個通用類,可以輕松增刪改查數據。本框架可以支持ie10、火狐、谷歌等主流瀏覽器。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Web;
using?System.Web.Caching;
namespace?CoreLib.common
{
????public?class?CacheHelper
????{
????????///?
????????///?讀取緩存數據
????????///?
????????///?鍵
????????///?
????????public?static?object?GetCache(string?cacheKey)
????????{
????????????var?objCache?=?HttpRuntime.Cache.Get(cacheKey);
????????????return?objCache;
????????}
????????///?
????????///?設置緩存數據
????????///?
????????///?鍵
????????///?值
????????public?static?void?SetCache(string?cacheKey?object?content)
????????{
????????????var?objCache?=?HttpRuntime.Cache;
????????????objCache.Insert(cacheKey?content);
????????}
????????///?
????????///?設置緩存數據并且設置默認過期時間
????????///?
????????///?
????????///?
????????///?
????????public?static?void?SetCache(string?cacheKey?object?content?int?timeOut?=?3600)
????????{
????????????try
????????????{
????????????????if?(content?==?null)
????????????????{
????????????????????return;
????????????????}
????????????????var?objCache?=?HttpRuntime.Cache;
????????????????//設置絕對過期時間
????????????????//絕對時間過期。DateTime.Now.AddSeconds(10)表示緩存在3600秒后過期,TimeSpan.Zero表示不使用平滑過期策略。
????????????????objCache.Insert(cacheKey?content?null?DateTime.Now.AddSeconds(timeOut)?TimeSpan.Zero?CacheItemPriority.High?null);
????????????????//相對過期
????????????????//DateTime.MaxValue表示不使用絕對時間過期策略,TimeSpan.FromSeconds(10)表示緩存連續10秒沒有訪問就過期。
????????????????//objCache.Insert(cacheKey?objobject?null?DateTime.MaxValue?timeout?CacheItemPriority.NotRemovable?null);?
????????????}
????????????catch?(Exception)
????????????{
????????????????throw;
????????????}
????????}
????????///?
????????///?移除指定緩存
????????///?
????????///?鍵
????????public?static?void?RemoveAllCache(string?cacheKey)
????????{
????????????var?objCache?=?HttpRuntime.Cache;
????????????objCache.Remove(cacheKey);
????????}
????????///?
????????///?刪除全部緩存
????????///?
????????public?static?void?RemoveAllCache()
????????{
????????????var?objCache?=?HttpRuntime.Cache;
????????????var?cacheEnum?=?objCache.GetEnumerator();
????????????while?(cacheEnum.MoveNext())
????????????{
????????????????objCache.Remove(cacheEnum.Key.ToString());
????????????}
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????4308480??2019-09-02?11:25??devicemanage.bak
?????文件???????1609??2019-06-29?09:01??devicemanage.sln
?????文件??????83856??2019-07-16?09:42??.vs\config\applicationhost.config
????..A..H.????138752??2019-09-03?10:49??.vs\devicemanage\v15\.suo
?????文件??????????0??2019-07-16?09:42??.vs\devicemanage\v15\Server\sqlite3\db.lock
?????文件???????4096??2019-07-16?09:42??.vs\devicemanage\v15\Server\sqlite3\storage.ide
?????文件??????32768??2019-09-03?10:45??.vs\devicemanage\v15\Server\sqlite3\storage.ide-shm
?????文件????3423752??2019-09-03?10:45??.vs\devicemanage\v15\Server\sqlite3\storage.ide-wal
?????文件??????47104??2019-09-03?08:39??CoreLib\bin\CoreLib.dll
?????文件????????453??2019-06-29?10:51??CoreLib\bin\CoreLib.dll.config
?????文件?????126464??2019-09-03?08:39??CoreLib\bin\CoreLib.pdb
?????文件?????177664??2019-03-30?17:21??CoreLib\bin\Dapper.dll
?????文件?????167783??2019-03-30?17:21??CoreLib\bin\Dapper.xm
?????文件????5225168??2017-10-23?13:15??CoreLib\bin\Entityfr
?????文件?????622288??2017-10-23?13:15??CoreLib\bin\Entityfr
?????文件??????40080??2018-05-24?13:38??CoreLib\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll
?????文件???????1805??2018-05-24?13:38??CoreLib\bin\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.xm
?????文件??????45416??2012-07-25?11:48??CoreLib\bin\Microsoft.Web.Infrastructure.dll
?????文件?????664576??2018-02-18?09:44??CoreLib\bin\Newtonsoft.Json.dll
?????文件?????684778??2018-02-18?09:44??CoreLib\bin\Newtonsoft.Json.xm
?????文件??????49584??2018-05-24?13:38??CoreLib\bin\roslyn\csc.exe
?????文件???????8220??2018-05-24?13:38??CoreLib\bin\roslyn\csc.exe.config
?????文件???????1496??2018-05-24?13:38??CoreLib\bin\roslyn\csc.rsp
?????文件??????15280??2018-05-24?13:38??CoreLib\bin\roslyn\csi.exe
?????文件???????8816??2018-05-24?13:38??CoreLib\bin\roslyn\csi.exe.config
?????文件????????279??2018-05-24?13:38??CoreLib\bin\roslyn\csi.rsp
?????文件?????122800??2018-05-24?13:38??CoreLib\bin\roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll
?????文件????4681136??2018-05-24?13:38??CoreLib\bin\roslyn\Microsoft.CodeAnalysis.CSharp.dll
?????文件??????29104??2018-05-24?13:38??CoreLib\bin\roslyn\Microsoft.CodeAnalysis.CSharp.sc
?????文件????2414512??2018-05-24?13:38??CoreLib\bin\roslyn\Microsoft.CodeAnalysis.dll
............此處省略1365個文件信息
評論
共有 條評論