redis.py 258 B

123456789
  1. import asyncio
  2. from random import randint
  3. @asyncio.coroutine
  4. def get_random_record(container):
  5. idx = randint(1, 10000)
  6. random_number = yield from container.engines['redis'].get('world:%i' % idx)
  7. return {'Id': idx, 'RandomNumber': random_number}