我目前正在处理一个需要使用memcached的项目。经过了许多网站链接的研究,但我仍然不知道如何开始使用memcached。我已经使用过mongodb,但仍需要关于memcached配置的帮助。
我使用的是Windows 7操作系统,到目前为止,已经尝试使用以下链接:
http://www.codeforest.net/how-to-install-memcached-on-windows-machine
我目前正在处理一个需要使用memcached的项目。经过了许多网站链接的研究,但我仍然不知道如何开始使用memcached。我已经使用过mongodb,但仍需要关于memcached配置的帮助。
我使用的是Windows 7操作系统,到目前为止,已经尝试使用以下链接:
http://www.codeforest.net/how-to-install-memcached-on-windows-machine
好的,终于得到了答案...
我查看了超过50个与memcache相关的链接,唯一一个可以告诉你如何在项目中实现memcache的最佳链接是
http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=96698&av=163627
至于理论知识,请参考下面的链接
代码示例为
http://www.koders.com/csharp/fid80DA3A5A619DF298A8902A3E74A94B7A126D0438.aspx?s=socket
我创建了一个小文档,在开始使用memcache之前请先查看。
/// difference between set and add and replace
/// add property do not use to add key which is already exist in memcache
/// set use to overwite the key if that is already exist in memcache
/// if key already exist ,replace property can replace it other wise not,where else set property use to replace if key already exist other wise it will add new key in the memcache
///Important
///
/// if u are fetching the key which do not exist in memcache it will return null,as well if u are fetching the key whose value is null in memcache it will return null
/// so avoid inserting the key with null value
///
///If you simply want to avoid key collision between different types of data, simply prefix your key with a useful string. For example: "slash_1", "pradeep_1".
///
///
///
/// FlushAll() method use to remove(Flush) every thing from memcache
///
/// Stats() gives every information about the memcache like total items,connections,pId etc.....
/// difference between increment, decrement
///
/// to use Increment or Decrement first u need to store counter by StoreCounter method else u will get null
///
/// difference between GetMultiple and GetMultipleArray
///
///GetMultiple gives you the object with there key and GetMultipleArray gives you the object not the key
你需要一个Memcache服务器和一个Memcache客户端。
我发现Windows平台上最好的Memcache服务器之一是http://www.membase.com/products-and-services/memcached
它是由原始的Memcached开发人员构建的。安装只需几分钟,通过他们的Web界面进行配置非常容易。
推荐的.NET Memcache客户端是Enyim http://memcached.enyim.com/
你可以在https://github.com/enyim/EnyimMemcached/wiki找到Enyim的配置示例。
另外,我实际上发现Microsoft AppFabric Caching(代号Velocity)在.NET上工作得更好。我在使用Memcache和Linq对象时遇到了序列化问题,但AppFabric却没有问题。
如果您对AppFabric也感兴趣,这里有一个关于AppFabric的教程:
看起来他们希望你在类Unix/Linux操作系统上运行,根据这里的一些安装信息:http://code.google.com/p/memcached/wiki/NewInstallFromPackage
你也可以在虚拟机中安装Linux(尝试VirtualBox,它是免费的http://www.virtualbox.org/),然后尝试运行。
看起来它也有适用于Windows的端口:http://code.google.com/p/memcached/wiki/PlatformWindows
有没有安装过程中出现问题的具体部分?