• 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);
        }
  • 相关阅读:
    webpack devServer配置项的坑
    app混合开发 fastlick.js 在ios上 input标签点击 不灵敏 处理
    vue 学习八 自定义指令
    Verilog数值大小比较
    Verilog实现Matlab的fliplr函数
    基本不等式
    如何读取ila数据
    Xilinx FPGA时钟IP核注意事项
    FPGA Turbo译码器注意事项
    EbN0转SNR
  • 原文地址:https://www.cnblogs.com/amywechat/p/5564335.html
Copyright © 2020-2023  润新知