redisservicestack.redis

How to set a string with TTL with StackExchange.Redis


I'm looking for a way to do a very simple TTL string in Redis:

So how do I do the equivalent of the following in StackExchange.Redis?

SETEX lolcat 10 "monorailcat"

I found KeyExpire, but that means every key I set needs two calls?


Solution

  • Oops. Never mind:

    _Redis.StringSet( "lolcat", "monorailcat", TimeSpan.FromSeconds(10) );