• Enyim.Caching 客户端配置及示例


    一、工作准备

      memcached客户端:Enyim.Caching.2.13

      memcached服务器:memcached-win64-1.4.4-14

      备注:不建议使用windows服务器,开发环境可以玩玩

    二、Enyim.Caching配置

    <configSections>
        <sectionGroup name="enyim.com">
          <section name="memcached" type="Enyim.Caching.Configuration.MemcachedClientSection, Enyim.Caching" />
        </sectionGroup>
      </configSections>
    
      <enyim.com>
        <!--memcached在windows下不支持二进制协议,必须使用Text;Linux下可使用Binary-->
        <memcached protocol="Text">
          <servers>
            <add address="192.168.1.101" port="11211" />
          </servers>
          <socketPool minPoolSize="10" maxPoolSize="100" connectionTimeout="00:01:10" deadTimeout="00:02:00" />
        </memcached>
      </enyim.com>
    

      三、后台代码简单实现

    private static Enyim.Caching.MemcachedClient mc = new Enyim.Caching.MemcachedClient();
    
        public ActionResult Memcached()
        {
            return View();
        }
    
        public ActionResult SetMemcached(string key, string value)
        {
            var result = mc.Store(Enyim.Caching.Memcached.StoreMode.Set, key, value);
    
            return JRCommonHandleResult(result);
        }
    
        public ActionResult GetMemcached(string key)
        {
            var content = mc.Get<string>(key);
    
            return JRSuccess(content);
        }
    

      

  • 相关阅读:
    linux下activemq安装
    java 线程方法join
    创建线程池
    游标储存过程
    返回结果集的储存过程
    linux 安装 reids 出错解决问题
    IDEAL 集成 jFINAL 问题
    oracle 游标
    oracle procedures
    Linux下安装Tomcat服务器
  • 原文地址:https://www.cnblogs.com/Jeely/p/10785513.html
Copyright © 2020-2023  润新知