Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sunxiaotianmg
Mozi.HttpEmbedded
提交
cb5c64e1
M
Mozi.HttpEmbedded
项目概览
sunxiaotianmg
/
Mozi.HttpEmbedded
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Mozi.HttpEmbedded
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
cb5c64e1
编写于
6月 23, 2021
作者:
JasonWcx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Runtime中增加api Cache
上级
30ac0b08
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
7 deletion
+36
-7
Mozi.HttpEmbedded/Cache/MemoryCache.cs
Mozi.HttpEmbedded/Cache/MemoryCache.cs
+2
-2
Mozi.HttpEmbedded/HttpServer.cs
Mozi.HttpEmbedded/HttpServer.cs
+8
-1
Mozi.HttpEmbedded/Page/RuntimeApi.cs
Mozi.HttpEmbedded/Page/RuntimeApi.cs
+26
-4
未找到文件。
Mozi.HttpEmbedded/Cache/MemoryCache.cs
浏览文件 @
cb5c64e1
...
...
@@ -49,7 +49,7 @@ namespace Mozi.HttpEmbedded.Cache
cache
.
IsPrivate
=
isprivate
;
if
(
isNew
)
{
_caches
.
Insert
(
0
,
cache
);
_caches
.
Add
(
cache
);
}
}
}
...
...
@@ -59,7 +59,7 @@ namespace Mozi.HttpEmbedded.Cache
/// <param name="name"></param>
/// <param name="param"></param>
/// <returns></returns>
public
CacheInfo
Get
(
string
name
,
string
param
)
public
CacheInfo
Find
(
string
name
,
string
param
)
{
lock
(
_sync
)
{
...
...
Mozi.HttpEmbedded/HttpServer.cs
浏览文件 @
cb5c64e1
...
...
@@ -2,6 +2,7 @@
using
System.Linq
;
using
System.Net.Sockets
;
using
Mozi.HttpEmbedded.Auth
;
using
Mozi.HttpEmbedded.Cache
;
using
Mozi.HttpEmbedded.Cert
;
using
Mozi.HttpEmbedded.Common
;
using
Mozi.HttpEmbedded.Compress
;
...
...
@@ -53,7 +54,7 @@ namespace Mozi.HttpEmbedded
/// <summary>
/// 默认为程序集运行路径的TEMP目录
/// </summary>
private
string
_tempPath
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Temp\"
;
private
string
_tempPath
=
AppDomain
.
CurrentDomain
.
BaseDirectory
+
@"Temp\"
;
private
string
_serverRoot
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
private
string
_serverName
=
"HttpEmbedded"
;
...
...
@@ -70,6 +71,9 @@ namespace Mozi.HttpEmbedded
private
CertManager
_certMg
;
//HTTPS开启标识
private
bool
_httpsEnabled
=
false
;
private
MemoryCache
_cache
=
new
MemoryCache
();
/// <summary>
/// 服务器启动时间
/// </summary>
...
...
@@ -155,6 +159,9 @@ namespace Mozi.HttpEmbedded
get
{
return
_serverRoot
;
}
private
set
{
_serverRoot
=
value
;
}
}
internal
MemoryCache
Cache
{
get
{
return
_cache
;
}
}
public
HttpServer
()
{
StartTime
=
DateTime
.
MinValue
;
...
...
Mozi.HttpEmbedded/Page/RuntimeApi.cs
浏览文件 @
cb5c64e1
...
...
@@ -229,13 +229,35 @@ namespace Mozi.HttpEmbedded.Page
/// <summary>
/// 全局缓存-内存型
/// </summary>
/// <param name="action">query|add|remove|clear</param>
/// <param name="name"></param>
/// <param name="param"></param>
/// <param name="data"></param>
/// <returns></returns>
internal
ResponseMessage
Cache
(
)
public
ResponseMessage
Cache
(
string
action
,
string
name
,
string
param
,
string
data
)
{
ResponseMessage
rm
=
new
ResponseMessage
ResponseMessage
rm
=
new
ResponseMessage
();
if
(
action
==
"query"
)
{
success
=
true
};
rm
.
data
=
Context
.
Server
.
Cache
.
Find
(
name
,
param
);
}
else
if
(
action
==
"add"
)
{
Context
.
Server
.
Cache
.
Add
(
name
,
param
,
data
);
}
else
if
(
action
==
"remove"
)
{
Context
.
Server
.
Cache
.
Remove
(
name
,
param
);
}
else
if
(
action
==
"clear"
)
{
Context
.
Server
.
Cache
.
ClearExpired
();
}
else
{
rm
.
success
=
false
;
}
rm
.
success
=
true
;
return
rm
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录