2011-01-31 113 views
10

目前我正在開發一個需要使用memcached的項目。我通過大量的網絡鏈接進行了研究,但我不明白如何開始使用memcached。我已經使用過mongodb,但希望能夠幫助配置memcached。如何從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

回答

12

好吧,我終於得到了答案......

我走過來的memcache相關超過50鏈接了,這給你如何在項目中實施的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 
10

您將需要一個Memcache服務器和一個Memcache客戶端。

我發現了Windows平臺的最佳內存緩存服務器中的一個http://www.membase.com/products-and-services/memcached

它是由原始的Memcached開發建造。安裝過程需要幾分鐘的時間,通過他們的網絡界面,配置非常簡單。

推薦的內存緩存客戶端.NET是Enyim http://memcached.enyim.com/

您可以在https://github.com/enyim/EnyimMemcached/wiki

找到配置示例爲Enyim另外,我居然發現微軟AppFabric緩存(代號速度)的工作更好。淨。我遇到了Memcache和Linq對象的序列化問題,AppFabric沒有任何問題。

這裏是AppFabric的教程,如果你感興趣的是還有

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