我正在尝试调用上述方法来缓存更新时的已排序人员列表
public Task WriteAsync(IDataTransaction transaction, Person model)
{
var redis = transaction.GetContext<RedisTransactionContext>().RedisTransaction;
redis.SetAddAsync("people", model.Identifier);
redis.StringSetAsync(model.Identifier, JsonConvert.SerializeObject(model));
redis.StringSetAsync($"people_name_{model.Identifier}", model.Name.FullReverse());
redis.SortAndStoreAsync("people_by_name", "people", by: "people_name_*");
return Task.CompletedTask;
}然后我会打电话给
var database = _connection.GetDatabase();
var identifiers = await database.ListRangeAsync("people_by_name", index, index + count);但是它找不到新的列表,因为SortAndStoreAsync没有创建排序的列表-所有其他数据都在那里
我是不是做错了什么,事务内部是否支持SortAndStoreAsync?
发布于 2016-06-06 23:46:12
啊,我没有添加SortType.Alphabetic
redis.SortAndStoreAsync("people_by_name", "people", by: "people_name_*", sortType: SortType.Alphabetic);因为您是这样的:)
https://stackoverflow.com/questions/37661508
复制相似问题