下载全局缓存方案说明
<h3>全局缓存</h3>
<p>全局缓存地址: %appdata%/../locallow/ND/labResCache
全局缓存大小:500M
缓存超过大小策略:删除最近未使用的文件
所有的应用要使用同一个全局缓存地址,否则没有意义。</p>
<h3>资源中心流程</h3>
<pre><code class="language-plantuml">
@startuml
:start;
:请求下载地址;
if (缓存命中) then (yes)
:更新缓存文件最后访问时间;
stop
else (nothing)
:下载资源到缓存;
:更新缓存文件最后访问时间;
endif
stop
@enduml
</code></pre>
<p>更新最后访问时间代码示例</p>
<pre><code class="language-csharp">FileInfo file = new FileInfo(path);
file.LastAccessTime = new DateTime()...</code></pre>
<h3>小程序流程</h3>
<p>小程序定期清理缓存目录,防止缓存目录占用太大磁盘空间,做清理工作时候,最好要保证没有应用在运行,尤其是自己的资源中心可能还在工作</p>
<pre><code class="language-plantuml">
@startuml
:start;
while (没有应用运行)
:等待1小时;
:根据最后访问时间排序缓存文件;
:删除超出500M的缓存文件;
endwhile
stop
@enduml
</code></pre>
<h3>安装程序流程</h3>
<pre><code class="language-plantuml">@startuml
:start;
:安装3D播放器;
:安装引擎资源到缓存目录;
@enduml
</code></pre>