def record_usage(key_prefix, time_slice):
 key = _make_ratelimit_cache_key(key_prefix, time_slice)
 try:
  g.ratelimitcache.add(key, 0, time=time_slice.remaining)
  try:
   return g.ratelimitcache.incr(key)
  except pylibmc.NotFound:
   now = int(time.time())
   if (now < time_slice.end):
    g.ratelimitcache.add(key, 1, time=((time_slice.end - now) + 1))
    g.stats.simple_event('ratelimit.eviction')
   return 1
 except pylibmc.Error as e:
  raise RatelimitError(e)

def record_usage ( key_prefix , time_slice ) : key = _make_ratelimit_cache_key ( key_prefix , time_slice ) try : g . ratelimitcache . add ( key , 0 , time = time_slice . remaining ) try : return g . ratelimitcache . incr ( key ) except pylibmc . NotFound : now = int ( time . time ( ) ) if ( now < time_slice . end ) : g . ratelimitcache . add ( key , 1 , time = ( ( time_slice . end - now ) + 1 ) ) g . stats . simple_event ( 'ratelimit.eviction' ) return 1 except pylibmc . Error as e : raise RatelimitError ( e )
record usage of a ratelimit for the specified time slice .