Servicestack csharp 客户端与 Redis 或两者兼而有之?

Servicestack csharp client vs Redis or both?

我想要缓存以最大化响应时间和数据库使用率。我正在尝试确定是否应该在我的新 .netcore 服务中使用 csharp 客户端或 Redis 或两者 API。在我看来,我应该只使用 Redis。有人知道我是否应该出于某种原因同时使用两者吗?或者,我应该只使用服务客户端来处理缓存并忽略 Redis 吗?

http://docs.servicestack.net/csharp-client

https://github.com/ServiceStack/ServiceStack.Redis

这 2 个库不相关,C# Service Clients enables a Typed API to access your Services from .NET Apps whilst the ServiceStack.Redis provides a Typed API to access the Redis 来自 .NET 的内存数据库。

你需要什么取决于你的用例,如果你使用负载平衡服务器而不是使用像 Redis 这样的 distributed caching provider,那么推荐所有负载平衡应用程序服务器使用相同的分布式缓存和用户会话,如果您只使用单个服务器而不是使用分布式 Redis 缓存,则不会像默认的 In Memory Cache 那样有用,因为它会更快。

C# .NET 服务客户端没有任何内置缓存,为了在服务客户端中使用缓存,您的服务需要使用 HTTP Caching which returns HTTP caching primitive instructions that maintain "client caches" when using Cache Aware Service Clients

如果您只使用 "Server Caching" 功能,如 [CacheResponse(Duration)] 属性或任何 ToOptimizedResult* API,那么缓存仅在服务器上,这对任何 HTTP 客户端都是透明的都将访问​​相同的 "Server Cached Responses"。