Manu Mohan
Manu Mohan

Reputation: 1814

StackExchange.Redis IDatabase.SetScan() is not returning cursor

Here is my code

 ConnectionMultiplexer plex;
 plex = redisConnectionProvider.GetMultiplexer();
 var db = plex.GetDatabase();
 var values = db.SetScan(key);

I thought return values of SetScan will be an IEnumerable<> where the first element is a cursor and second element is a set of values from the Redis Set. But the result contains only set members- no cursor value. What am I missing here?

Upvotes: 2

Views: 2319

Answers (1)

thepirat000
thepirat000

Reputation: 13124

SetScan actually returns an IEnumerable<RedisValue>.

The cursor will be internally handled by the library. Depending on your parameters and server features, it will use SMEMBERS or SSCAN.

You can operate over the resulting IEnumerable for example:

IEnumerable<RedisValue> values = db.SetScan(key, "a*");
var firstItem = values.First();

Will return the first matched element starting with a.

Upvotes: 1

Related Questions