Update: From version 6.0.3 (ServiceStack.Redis) the feature will be directly accessible from RedisClient.
Thanks to mythz for the info.
Exploring GitHub source code you can see that RedisClient extends RedisClientNative, this latter do have the GetRange method available, so the first solution is as follow:
var nativeClient = redisClient as RedisNativeClient;
var prefix = nativeClient?.GetRange(key, from, to)?.FromUtf8Bytes();
This solution is nice and simple and possibly will always work, but we are relying on ServiceStack to always implement RedisClient extending RedisNativeClient, but we can't be 100% sure about it.
The alternative solution is to leverage the LUA script execution feature, where you can:
var prefix = redisClient.ExecLuaAsString("return redis.call('GETRANGE', ARGV[1], ARGV[2], ARGV[3])", key, from, to);
Performance wise the Native approach is slightly faster and uses less memory.
