def tag_id_name_count_list_by_tag_admin(limit, offset): id_count = redis.zrevrange(REDIS_TAG_ADMIN, offset, offset+limit-1, True, int) zsite_list = Zsite.mc_get_list(map(itemgetter(0), id_count)) r = [] for i,count in zip(zsite_list, map(itemgetter(1),id_count)): r.append((i.id, i.name, count)) return r, redis.zcard(REDIS_TAG_ADMIN)
def _(cid): for tag_id in id_list: #将分数放到相应的ranged set里面 key = REDIS_TAG_CID % (tag_id, cid) count = max(redis.zcard(key) - 1, 0) p = redis.pipeline() p.zrem(key, po_id) for i in (REDIS_REC_TAG_NEW, REDIS_REC_TAG_OLD): key = i % tag_id p.zrem(key, po_id) p.hset(REDIS_TAG_CID_COUNT % tag_id, cid, count) p.execute()
def _(cid): for tag_id in id_list: #将分数放到相应的ranged set里面 key = REDIS_TAG_CID%(tag_id, cid) count = max(redis.zcard(key) - 1, 0) p = redis.pipeline() p.zrem(key, po_id) for i in (REDIS_REC_TAG_NEW, REDIS_REC_TAG_OLD): key = i%tag_id p.zrem(key, po_id) p.hset(REDIS_TAG_CID_COUNT%tag_id, cid, count) p.execute()
def rec_read_log_count_by_user_id(user_id): key = REDIS_REC_USER_LOG%user_id return redis.zcard(key)