rabbitMQ交换机的发布订阅模式
摘要:生产者: # !/usr/bin/env python # -*- coding: utf-8 -*- import pika # 创建连接对象 connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhos
阅读全文
rabbitMQ 的简单模式
摘要:生产者: # !/usr/bin/env python # -*- coding: utf-8 -*- import pika # 创建连接对象 connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhos
阅读全文
redis 的发布订阅
摘要:Redis 订阅者 #-*- coding: utf8 -*- import redis r = redis.Redis() # 获取订阅对象 pub = r.pubsub() pub.subscribe("104.5fm") # pub.parse_response() while True: m
阅读全文
redis 的管道操作
摘要:#-*- coding: utf8 -*- import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 支持事务 pipe = r.pipeline(transaction=True) pipe
阅读全文
redis 的其他常用操作
摘要:#-*- coding: utf8 -*- import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 删除操作 print(r.keys()) r.delete(*["xxx"]) # 要加星
阅读全文
redis 的链表操作
摘要:#-*- coding: utf8 -*- import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 增加操作 r.lpush("stu","zhangsan","lisi","wangwu"
阅读全文
redis 的哈希操作
摘要:#-*- coding: utf8 -*- import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 设置获取 r.hset("info", "name", "alex") print(r.h
阅读全文
redis 的字符串操作
摘要:import redis pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool) # 设置有效时间 r.set("gender","male",20) # 当name 不存在时,执行设置操作 r.setnx("salar
阅读全文
redis 的数据类型
摘要:key:value 字符串 链表 Hash 集合 有序集合
阅读全文
Redis的基本操作
摘要:import redis # 简单连接 r = redis.Redis() print(r.get("name"))r.set("age",9000) # 基于连接池 pool = redis.ConnectionPool() r = redis.Redis(connection_pool=pool
阅读全文