Skip to content

Commit

Permalink
update interceptor sample for (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
catcherwong committed Oct 25, 2020
1 parent cbb7e2b commit b45674e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public string Aspectcore(int type = 1)
var res = _aService.GetDemo(111);
return $"{res.Id}-{res.Name}-{res.CreateTime}";
}
else if (type == 5)
{
var res = _aService.GetData();
return Newtonsoft.Json.JsonConvert.SerializeObject(res);
}
else
{
return "wait";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public interface IAspectCoreService //: EasyCaching.Core.Internal.IEasyCaching

[EasyCachingAble(Expiration = 10)]
Demo GetDemo(int id);

[EasyCachingAble(Expiration = 10)]
object GetData();
}

public class AspectCoreService : IAspectCoreService
Expand Down Expand Up @@ -71,6 +74,10 @@ public string PutSomething(string str)
return str;
}

public object GetData()
{
return new { x = System.DateTimeOffset.Now.ToUnixTimeSeconds() };
}
}

[ProtoContract]
Expand Down

0 comments on commit b45674e

Please sign in to comment.