博客
关于我
python 和c#共用memcached
阅读量:244 次
发布时间:2019-03-01

本文共 827 字,大约阅读时间需要 2 分钟。

python写入:

from pymemcache.client.base import Clientclient = Client(('127.0.0.1', 11211))。。。if __name__=='__main__':    print('正在运行资源监控程序...')    while True:        client.set('info_disk',getDisk())        client.set('info_net',getNet())        client.set('info_mem',getMemorystate())        client.set('info_cpu',getCPUstate(1))

c#读取:

string[] ips = System.Configuration.ConfigurationManager.AppSettings["MemcachedServers"].Split(',');            SockIOPool pool = SockIOPool.GetInstance();            pool.SetServers(ips);            pool.Initialize();            client = new MemcachedClient();            client.PrimitiveAsString = true;//加这个参数,可以与其他程序混写缓存            client.EnableCompression = true;。。。。。。 MmHelper mm = new MmHelper(); string tt = mm.Get("info_cpu").ToString();

重要的是要设置这个参数:client.PrimitiveAsString = true;

转载地址:http://tgrv.baihongyu.com/

你可能感兴趣的文章
mysql中int、bigint、smallint 和 tinyint的区别、char和varchar的区别详细介绍
查看>>
mysql中json_extract的使用方法
查看>>
mysql中json_extract的使用方法
查看>>
mysql中null和空字符串的区别与问题!
查看>>
MySQL中ON DUPLICATE KEY UPDATE的介绍与使用、批量更新、存在即更新不存在则插入
查看>>
MYSQL中TINYINT的取值范围
查看>>
Mysql中varchar类型数字排序不对踩坑记录
查看>>
mysql中出现update-alternatives: 错误: 候选项路径 /etc/mysql/mysql.cnf 不存在 dpkg: 处理软件包 mysql-server-8.0的解决方法(全)
查看>>
MySQL中地理位置数据扩展geometry的使用心得
查看>>
Mysql中存储引擎简介、修改、查询、选择
查看>>
mysql中实现rownum,对结果进行排序
查看>>
mysql中对于数据库的基本操作
查看>>
mysql中的 +号 和 CONCAT(str1,str2,...)
查看>>
MySql中的concat()相关函数
查看>>
mysql中的concat函数,concat_ws函数,concat_group函数之间的区别
查看>>
MySQL中的count函数
查看>>
MySQL中的DB、DBMS、SQL
查看>>
MySQL中的DECIMAL类型:MYSQL_TYPE_DECIMAL与MYSQL_TYPE_NEWDECIMAL详解
查看>>
MySQL中的GROUP_CONCAT()函数详解与实战应用
查看>>
MySQL中的IO问题分析与优化
查看>>