【发布时间】:2015-07-20 04:16:46
【问题描述】:
如果我有课
public class Article
{
public int Id { get; set; }
public string Title { get; set; }
public string ShortDesc { get; set; }
public DataTime UpateDate { get; set; }
}
根据 UpdateDate 从 Redis 缓存中获取用户列表的最佳方法是什么?
我在 Redis 中看到了许多关于最新列表的示例,但他们都认为添加到列表中的最新元素是最新的,而且获取最近条目列表非常容易。
但就我而言,我需要根据更新日期列出列表或最近更新的文章,例如
记者在一大早添加了一篇带有今天日期的文章 (Id 1 ),然后意识到他错过了昨天的新闻 (Id 2),该新闻需要在网站上使用回溯日期。之后,他添加了一篇带有今天日期的新文章(ID 3)
所以我的提要应该列出:
- 文章 ID 3
- 文章 ID 1
- 文章 ID 2
使用 Redis 实现这一目标的最佳方法是什么?
谢谢
【问题讨论】:
标签: c# model-view-controller redis servicestack