Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 588
Dirk Boer Avatar asked Aug 10 '14 14:08

Dirk Boer


1 Answers

Oops. Never mind:

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

like image 140
Dirk Boer Avatar answered Oct 11 '22 12:10

Dirk Boer