'Allow API methods to store objects from a DB query to be
used by API extensions within the same API request.
An instance of this class only lives for the lifetime of a
single API request, so there\'s no need to implement full
cache management.'

def cache_db_items(self, key, items, item_key='id'):

    db_items = self._extension_data['db_items'].setdefault(key, {})
    for item in items:
        db_items[item_get(item, item_key)] = item
