is there no async equivalent for redis getbyid?
Hi @bobk,
Using the RedisClient
you can use client.AsAsync()
to get a typed async client. See the ServiceStack.Redis GitHub repository readme for docs here.
For usage in a ServiceStack service, see example below.
public class MyService : Service
{
public async Task<object> Any(MyRequest request)
{
await using var redis = await GetRedisAsync();
await redis.IncrementAsync(nameof(MyRequest), 1);
}
}
For GetByIdAsync
, eg you could get your own MyUser data using the above client as redis.GetByIdAsync<MyUser>("key");
.
1 Like