25,980
社区成员
发帖
与我相关
我的任务
分享



protected void Page_Load(object sender, EventArgs e)
{
MemcachedClient mc = new MemcachedClient();
mc.Store(StoreMode.Set, "TestString", "Hello world!");
Response.Write(mc.Get<string>("TestString"));
}
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<sectionGroup name="enyim.com">
<section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching"/>
</sectionGroup>
</configSections>
<enyim.com>
<memcached>
<servers>
<!--在这里添加你的缓存服务器地址,可以是多个,IP地址以及对应的端口-->
<add address="192.168.1.132" port="11211" />
<!--<add address="127.0.0.1" port="11211" />-->
</servers>
<!--这里进行连接池大小、连接超时设置等参数的配置-->
<socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:00:30" deadTimeout="00:02:00" />
</memcached>
</enyim.com>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
</system.web>
</configuration>



肯定先上网找解决方案,找不到才来这里的。