.NET中MemCached使用介绍
- 一、安装MemCached服务端并启动服务

cd C:\Program Files\memcached memcached.exe -d install memcached -d start
- 二、VS项目中添加EnyimMemcached packages 包
- 三、WebConfig配置
<?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkId=301880 --> <configuration> <configSections> <sectionGroup name="enyim.com"> <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" /> </sectionGroup> <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" /> </configSections> <enyim.com> <memcached protocol="Binary"> <servers> <add address="127.0.0.1" port="11211" /> </servers> <socketPool minPoolSize="10" maxPoolSize="20" connectionTimeout="00:00:10" deadTimeout="00:00:10" /> <keyTransformer type="Enyim.Caching.Memcached.TigerHashKeyTransformer, Enyim.Caching" /> </memcached> </enyim.com> </configuration>
- 注意事项
写入对象到memcached应该是序列化的对象,在对象前增加允许被序列化属性即可[

浙公网安备 33010602011771号