• 
      

    Cache object lookups in WebAPIResource.get_object.

    Review Request #5906 — Created May 30, 2014 and submitted — Latest diff uploaded

    Information

    Djblets
    release-0.8.x
    1e2829c...

    Reviewers

    It's pretty common for different parts of a WebAPIResource subclass to
    perform a get_object() call either on itself or on another resource.
    This will happen in get_queryset() and in the permission-checking
    functions. These checks are time-consuming and result in excess
    database queries.

    The built-in get_object() now supports caching of these objects. The
    caches are tied to the request, so any redundant get_object() calls
    taking place within that request will just use the original call's
    result.

    Djblets and Review Board unit tests pass.

    Review Board unit tests gained nearly a 2 second increase in speed for
    the API tests.

    Tested a few resources I suspected had redundant calls. Saw the query counts
    drop.