博客
关于我
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的btree索引和hash索引的区别
查看>>
mysql的cast函数
查看>>
MySql的CRUD(增、删、改、查)操作
查看>>
MySQL的DATE_FORMAT()函数将Date转为字符串
查看>>
mysql的decimal与Java的BigDecimal用法
查看>>
MySql的Delete、Truncate、Drop分析
查看>>
MySQL的Geometry数据处理之WKB方案
查看>>
MySQL的Geometry数据处理之WKT方案
查看>>
mysql的grant用法
查看>>
Mysql的InnoDB引擎的表锁与行锁
查看>>
mysql的InnoDB引擎索引为什么使用B+Tree
查看>>
MySQL的InnoDB默认隔离级别为 Repeatable read(可重复读)为啥能解决幻读问题?
查看>>
MySQL的insert-on-duplicate语句详解
查看>>
mysql的logrotate脚本
查看>>
MySQL的my.cnf文件(解决5.7.18下没有my-default.cnf)
查看>>
MySQL的on duplicate key update 的使用
查看>>
MySQL的Replace用法详解
查看>>
mysql的root用户无法建库的问题
查看>>
mysql的sql_mode参数
查看>>
MySQL的sql_mode模式说明及设置
查看>>