def record_usage_multi(prefix_slices):
 keys = [_make_ratelimit_cache_key(k, t) for (k, t) in prefix_slices]
 try:
  now = int(time.time())
  for (key, (_, time_slice)) in zip(keys, prefix_slices):
   g.ratelimitcache.add(key, 0, time=((time_slice.end - now) + 1))
  try:
   recent_usage = g.ratelimitcache.incr_multi(keys)
  except pylibmc.NotFound:
   now = int(time.time())
   if (now < time_slice.end):
    recent_usage = []
    for (key, (_, time_slice)) in zip(keys, prefix_slices):
     if g.ratelimitcache.add(key, 1, time=((time_slice.end - now) + 1)):
      recent_usage.append(1)
      g.stats.simple_event('ratelimit.eviction')
     else:
      recent_usage.append(g.ratelimitcache.get(key))
  return recent_usage
 except pylibmc.Error as e:
  raise RatelimitError(e)

def record_usage_multi ( prefix_slices ) : keys = [ _make_ratelimit_cache_key ( k , t ) for ( k , t ) in prefix_slices ] try : now = int ( time . time ( ) ) for ( key , ( _ , time_slice ) ) in zip ( keys , prefix_slices ) : g . ratelimitcache . add ( key , 0 , time = ( ( time_slice . end - now ) + 1 ) ) try : recent_usage = g . ratelimitcache . incr_multi ( keys ) except pylibmc . NotFound : now = int ( time . time ( ) ) if ( now < time_slice . end ) : recent_usage = [ ] for ( key , ( _ , time_slice ) ) in zip ( keys , prefix_slices ) : if g . ratelimitcache . add ( key , 1 , time = ( ( time_slice . end - now ) + 1 ) ) : recent_usage . append ( 1 ) g . stats . simple_event ( 'ratelimit.eviction' ) else : recent_usage . append ( g . ratelimitcache . get ( key ) ) return recent_usage except pylibmc . Error as e : raise RatelimitError ( e )
record usage of multiple rate limits .