'INTERNAL USE ONLY. DO NOT USE METHOD DIRECTLY. INSTEAD USE
db.composite_for() OR mi.get(). Those methods make sure there is no
risk of infinite recursion when evaluating templates that refer to
themselves.'

def _render_composite_with_cache(self, book_id, mi, formatter, template_cache):

    with self._lock:
        ans = self._render_cache.get(book_id, None)
    if (ans is None):
        return self.__render_composite(book_id, mi, formatter, template_cache)
    return ans
