def add_queries(queries, insert_items=None, delete_items=None):
 for q in queries:
  if (insert_items and q.can_insert()):
   g.log.debug(('Inserting %s into query %s' % (insert_items, q)))
   with g.stats.get_timer('permacache.foreground.insert'):
    q.insert(insert_items)
  elif (delete_items and q.can_delete()):
   g.log.debug(('Deleting %s from query %s' % (delete_items, q)))
   with g.stats.get_timer('permacache.foreground.delete'):
    q.delete(delete_items)
  else:
   raise Exception(('Cannot update query %r!' % (q,)))
 with CachedQueryMutator() as m:
  new_queries = [getattr(q, 'new_query') for q in queries if hasattr(q, 'new_query')]
  if insert_items:
   for query in new_queries:
    m.insert(query, tup(insert_items))
  if delete_items:
   for query in new_queries:
    m.delete(query, tup(delete_items))

def add_queries ( queries , insert_items = None , delete_items = None ) : for q in queries : if ( insert_items and q . can_insert ( ) ) : g . log . debug ( ( 'Inserting %s into query %s' % ( insert_items , q ) ) ) with g . stats . get_timer ( 'permacache.foreground.insert' ) : q . insert ( insert_items ) elif ( delete_items and q . can_delete ( ) ) : g . log . debug ( ( 'Deleting %s from query %s' % ( delete_items , q ) ) ) with g . stats . get_timer ( 'permacache.foreground.delete' ) : q . delete ( delete_items ) else : raise Exception ( ( 'Cannot update query %r!' % ( q , ) ) ) with CachedQueryMutator ( ) as m : new_queries = [ getattr ( q , 'new_query' ) for q in queries if hasattr ( q , 'new_query' ) ] if insert_items : for query in new_queries : m . insert ( query , tup ( insert_items ) ) if delete_items : for query in new_queries : m . delete ( query , tup ( delete_items ) )
adds multiple queries to the query queue .