zoukankan      html  css  js  c++  java
  • Python memcache和redis

    1.memcache的安装

    http://www.cnblogs.com/zgx/archive/2011/08/10/2134097.html

    memcached -d -m 10    -u root -l 192.168.15.128 -p 12000 -c 256 -P /tmp/memcached.pid

    参数说明:
        -d 是启动一个守护进程
        -m 是分配给Memcache使用的内存数量,单位是MB
        -u 是运行Memcache的用户
        -l 是监听的服务器IP地址
        -p 是设置Memcache监听的端口,最好是1024以上的端口
        -c 选项是最大运行的并发连接数,默认是1024,按照你服务器的负载量来设定
        -P 是设置保存Memcache的pid文件

    2.在memcache模块中执行程序报错

    a bytes-like object is required, not 'str' - error

    原因是:

    python-memchached is not supported on python 3.5 If you've used python-memchached, The following commands will help you.

    pip uninstall python-memcached
    pip install python3-memcached

    3.memcache的示例

    import memcache
    
    mc = memcache.Client(['192.168.15.128:12000'],debug=True)
    mc.set("some_key", "Some value")
    ret = mc.get("some_key")
    print (ret)
    结果:
    Some value

    4.memcache的一些方法

    http://www.cnblogs.com/wupeiqi/articles/5132791.html

  • 相关阅读:
    delphi TOpenDialog
    delphi TSaveDialog
    Delphi中一些常用的组合键值
    delphi TColorDialog
    Delphi TFindDialog TReplaceDialog对话框在Memo中的使用
    Delphi ListView基本用法大全
    地球帝国3
    五笔难拆字字根表
    Delphi Format中的换行符号是什么
    myNote
  • 原文地址:https://www.cnblogs.com/python-study/p/5840922.html
Copyright © 2011-2022 走看看