如何从memcached开始

sla*_*dhe 12 .net c# memcached

目前我正在开发一个需要使用memcached的项目.我已经研究了很多网站链接,但我不明白如何开始使用memcached.我已经使用过mongodb但是想要帮助配置memcached.

我使用的是Windows 7操作系统,到目前为止使用了以下链接.

http://www.codeforest.net/how-to-install-memcached-on-windows-machine

http://memcached.org/

http://www.codeproject.com/KB/aspnet/memcached_aspnet.aspx

sla*_*dhe 15

好吧,最后我得到了答案......

我已经经历了超过50个与memcache相关的链接,这是一个最好也是唯一一个链接,可以帮助你在项目中实现memcache

http://www.codeproject.com/script/Articles/ArticleVersion.aspx?aid=96698&av=163627

有关理论知识,请参阅以下链接

http://code.google.com/p/memcached/wiki/FAQ#What_is_the_maximum_data_size_you_can_store?_(1_megabyte)

代码示例是

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
Run Code Online (Sandbox Code Playgroud)


mfa*_*nto 11

您将需要一个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的教程

http://www.hanselman.com/blog/InstallingConfiguringAndUsingWindowsServerAppFabricAndTheVelocityMemoryCacheIn10Minutes.aspx