How to set a string with TTL with StackExchange.Redis
Asked Answered
B

1

18

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?

Blanc answered 10/8, 2014 at 14:11 Comment(0)
B
28

Oops. Never mind:

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

Blanc answered 10/8, 2014 at 14:16 Comment(1)
Is there a way to MSET multiple strings with TTL?Ettaettari

© 2022 - 2024 — McMap. All rights reserved.