zoukankan      html  css  js  c++  java
  • 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);
        }
  • 相关阅读:
    和大家一起了解Windows Server 2016 License许可证授权方式
    centos的cockpit安装使用
    Nscan-20150223
    JexBoss-20170328
    InsightScan-20150320
    Clusterd-20151119
    BBScan-20200419
    Astra-20190405
    为什么计算机计算时间要从1970年开始
    Appium环境搭建
  • 原文地址:https://www.cnblogs.com/amywechat/p/5564335.html
Copyright © 2011-2022 走看看