'Store the current variant in the cache.'

def put(self, variant, size):

    request = cherrypy.serving.request
    response = cherrypy.serving.response
    uri = cherrypy.url(qs=request.query_string)
    uricache = self.store.get(uri)
    if (uricache is None):
        uricache = AntiStampedeCache()
        uricache.selecting_headers = [e.value for e in response.headers.elements('Vary')]
        self.store[uri] = uricache
    if (len(self.store) < self.maxobjects):
        total_size = (self.cursize + size)
        if ((size < self.maxobj_size) and (total_size < self.maxsize)):
            expiration_time = (response.time + self.delay)
            bucket = self.expirations.setdefault(expiration_time, [])
            bucket.append((size, uri, uricache.selecting_headers))
            header_values = [request.headers.get(h, '') for h in uricache.selecting_headers]
            uricache[tuple(sorted(header_values))] = variant
            self.tot_puts += 1
            self.cursize = total_size
