我试图实现从第三方web服务缓存数据到sql server数据库的一些功能。如何实现数据库缓存来自第三方Web服务的数据?
我有几个方法,如
IProduct GetProductById(int productId)
,IEnumerable<IProduct> ListProductsAllByCategoryId(int categoryId)
,IEnumerable<IProduct> ListProductsPagedByCategoryId(int categoryId, int pageNumber, int itemsOnPage, out int totalRowCount)
,- 等
所以,我有一个想法,代码/散列方法签名+参数作为Key并将输出序列化为Value并将此Key-Value-Pair存储在中数据库。
然后我打算只是通过密钥从数据库中获取这些项目。
问题:这是一个好主意,以及如何为(方法+参数)的每个组合实现唯一键?
任何其他解决方案对我来说都是有用的。
对我没有意义...... – 2010-11-11 10:32:29
过期怎么办?你打算无限期地保存数据吗? – 2010-11-11 10:54:51
是的,我将使用expiration datetime属性。 – gyromonotron 2010-11-11 11:02:42