'Insert items into the given cached query.
If the items are already in the query, they will have their sorts
updated.
This will sometimes trigger pruning with a configurable probability
(see g.querycache_prune_chance).'

def insert(self, query, things):

    if (not things):
        return
    LOG.debug('Inserting    %r    into    query    %r', things, query)
    assert (not query.is_precomputed)
    query._insert(self.mutator, things)
    if ((random.random() / len(things)) < PRUNE_CHANCE):
        self.to_prune.add(query)
