Slide 4
Slide 4 text
r = Redis()
!
def flush(type):
key = 'pending:{}'.format(type)
result = r.zrange(key, 0, -1,
withscores=True)
!
for id, count in result:
prms = {'type': type,
'count': count,
'id': id}
!
sql("""
update %(type)s
set count = count + %
(count)d
where id = %(id)s
""", prms)