缓存WCF服务的最佳实践 [英] Best practice on caching a WCF service

查看:96
本文介绍了缓存WCF服务的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个WCF服务,它将进行一些非常繁重的数据库查询,因此我想要缓存。 (System.Runtime.Caching)

出于性能原因,它也应该是多线程的。



如果我将实例上下文模式设置为PerCall I因为每个实例都重新创建缓存,所以无法使用MemoryCaching。

如果我将实例上下文模式设置为单一和并发模式为多个,缓存可以正常工作但我需要使所有线程安全。



我理解一切正确吗?

有什么更好的建议吗?

解决方案

< blockquote>如果您正在处理大量数据,那么使用系统缓存将不是一个好的解决方案。相反,您可以尝试使用memcache或membase来缓存数据。现在大多数网站都开始使用这种缓存技术。



http: //en.wikipedia.org/wiki/Memcached [ ^ ]



http://memcached.org [ ^ ]



使用Memcached实现分布式缓存 [ ^ ]


I need to create a WCF service that's going to do some pretty heavy database querying that I therefore want to cache. (System.Runtime.Caching)
For performance reasons it should also be multithreaded.

If I would set Instance Context Mode to PerCall I can't use MemoryCaching since the cache is recreated with every instance.
If I would set Instance Context Mode to Single and Concurrency Mode to Multiple, Caching would work just fine but I would need to make everything threadsafe.

Have I understood everything right?
Any better recommendations?

解决方案

If you are dealing with heavy data then using system cache will not be a good solution. Instead you can try memcache or membase for caching data. Now most of the websites has started following this caching technique.

http://en.wikipedia.org/wiki/Memcached[^]

http://memcached.org[^]

Implementing Distributed Caching using Memcached[^]


这篇关于缓存WCF服务的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆