ServiceStack - 自动查询和 OrmLiteCacheClient

ServiceStack - Autoquery & OrmLiteCacheClient

ServiceStack 具有一些很棒的功能,包括 AutoQuery and the most recent update includes a great Admin UI

我希望实现以下,使用OrmLiteCacheClient作为AutoQuery的数据库。

更具体地说,

  1. 我希望缓存(/存储)一些对象(响应 DTO)到 OrmLiteCacheClient

  2. 使用 AutoQuery 处理保存到 OrmLiteCacheClient 的那些实体的请求和响应

这可以实现吗?

I am hoping to achieve the following, use OrmLiteCacheClient as the database for AutoQuery.

不,那不可能,AutoQuery 的工作原理是从一个由远程 RDBMS 执行的 AutoQuery 请求构建一个 SQL 表达式,其结果用于填充 AutoQuery Response DTO。

但是您仍然可以像缓存任何其他服务一样缓存 AutoQuery 服务,例如:

public class TechnologyServices : Service
{
    public IAutoQuery AutoQuery { get; set; }

    //Cached AutoQuery
    public object Any(FindTechnologies query)
    {
        var key = Request.QueryString.ToString();
        return Request.ToOptimizedResultUsingCache(Cache, key, () =>
        {
            var q = AutoQuery.CreateQuery(query, Request);
            return AutoQuery.Execute(query, q);
        });
    }
}