| 1234567891011121314151617181920212223242526272829303132 |
- using System;
- using IwbZero.ToolCommon.CacheHelpers;
- namespace WeEngine
- {
- /// <summary>
- /// 运行态方案包缓存
- /// </summary>
- public class RuntimePackageCache : InfoCache<RuntimePackage>
- {
- public static RuntimePackageCache Instance = new RuntimePackageCache();
- public RuntimePackageCache() : base(60 * 24, 60)
- {
- }
-
- public virtual void SetCache(RuntimePackage runPackage)
- {
- Instance.AddCache(runPackage.Id + "", runPackage);
- }
- public virtual RuntimePackage GetCache(string runId)
- {
- if(!Instance.TryGetCache(runId, out var runtimePackage))
- {
- throw new Exception($"没有找到key为{runId}的缓存");
- }
- return runtimePackage;
- }
- }
- }
|