Home Ask Login Register

Developers Planet

Your answer is one click away!

lai tang February 2016

Service.Redis Trimming a list

Following tutorials that is using ServiceStack v3 and stuck at when trying to trim a list in V4.

What is the equivalent in V4? Trying to google examples but with no luck.


mythz February 2016

You can just use TrimList, e.g:

redis.TrimList(listId, keepStartingFrom, keepEndingAt);

Or you can use Trim() off IList, e.g:

redis.Lists[listId].Trim(keepStartingFrom, keepEndingAt);

Both TrimList() and IRedisList.Trim() also have Redis Typed Client API versions:

redis.As<Poco>().TrimList(listId, keepStartingFrom, keepEndingAt);
redis.As<Poco>().Lists[listId].Trim(keepStartingFrom, keepEndingAt);

Post Status

Asked in February 2016
Viewed 1,343 times
Voted 9
Answered 1 times


Leave an answer

Quote of the day: live life