Auto Query - Caching

Is it possible to enable caching using normal caching provider for all tables without doing the autoquery requests yourself. E.g. I want to cache on read and on insert, update, delete I want to invalidate the cache. The idea is to allow full text search using redisearch where the created index will automatically index the created hashes in redis. Alternatively I can tie into each(or certain) post/patch/put/delete event or hook into the crudevents to create a full text index for e.g. for redisearch/elasticsearch/typesense etc.

Thanks

You can use the [CacheResponse] attribute to cache AutoQuery responses, whilst they can be added to the Request DTO it would force adding a reference to ServiceStack.dll server assembly on DTOs, which is why it’s recommended to add them on a custom AutoQuery service implementation instead.

There’s also AutoQuery CRUD Event Filters you can use to invalidate caches for CRUD operations.

To change the behavior for all AutoQuery implementations you could provide a custom AutoQuery base service class which will let you provide custom implementations for every AutoQuery or CRUD request where you could use ToOptimizedResult* and HTTP Caching APIs to control the cache key.