Add cache prefix.

This commit is contained in:
Haiping Chen 2024-08-22 20:13:43 -05:00
parent 7b9572625c
commit 563b983985
2 changed files with 8 additions and 3 deletions

View file

@ -10,9 +10,12 @@ public class SharpCacheAttribute : MoAttribute
public static IServiceProvider Services { get; set; } = null!;
private int _minutes;
public SharpCacheAttribute(int minutes)
private string _prefix;
public SharpCacheAttribute(int minutes, string prefix = "cache")
{
_minutes = minutes;
_prefix = prefix;
}
public override void OnEntry(MethodContext context)
@ -40,8 +43,7 @@ public class SharpCacheAttribute : MoAttribute
private string GetCacheKey(MethodContext context)
{
// 根据用户级别生成缓存key
var key = string.Empty;
var key = _prefix;
foreach (var arg in context.Arguments)
{
if (arg is null)

View file

@ -46,10 +46,13 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="packages\**" />
<Compile Remove="Planning\**" />
<Compile Remove="Translation\Models\**" />
<EmbeddedResource Remove="packages\**" />
<EmbeddedResource Remove="Planning\**" />
<EmbeddedResource Remove="Translation\Models\**" />
<None Remove="packages\**" />
<None Remove="Planning\**" />
<None Remove="Translation\Models\**" />
</ItemGroup>