public Task CreateTopic(int id, string subject, DateTime postTime) { var timestamp = postTime.Ticks; var memberKey = $"topic:{id}"; var topic = new TopicListItem { Id = id, Subject = subject, LastReply = postTime, ReplyCount = 1 }; var tran = Database.CreateTransaction(); tran.SortedSetAddAsync(Key, id, timestamp); tran.HashSetAsync(memberKey, topic.ToHash()); return(tran.ExecuteAsync()); }
public async Task <TopicListItem> GetTopic(int topicId) { var entries = await Database.HashGetAllAsync($"topic:{topicId}"); return(TopicListItem.FromHash(entries)); }