Reputation: 2203
ServiceStack comes with some great features including AutoQuery and the most recent update includes a great Admin UI.
I am hoping to achieve the following, use OrmLiteCacheClient as the database for AutoQuery.
More specifically,
I am looking to cache(/store) a number of objects (Response DTOs) to OrmLiteCacheClient
Use AutoQuery for taking care of request and response of those entities saved to the OrmLiteCacheClient
Is this achievable?
Upvotes: 1
Views: 124
Reputation: 143319
I am hoping to achieve the following, use OrmLiteCacheClient as the database for AutoQuery.
No that's not possible, AutoQuery works by constructing an SQL expression from an AutoQuery Request which gets executed by a remote RDBMS, the results of which are used to populate the AutoQuery Response DTO.
But you can still Cache an AutoQuery Service like any other Service, e.g:
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);
});
}
}
Upvotes: 2