[IMP] base, mail: cache user.has_group() + ir.ui.menu.load*()
authorOlivier Dony <odo@openerp.com>
Thu, 17 Jul 2014 15:18:14 +0000 (17:18 +0200)
committerOlivier Dony <odo@openerp.com>
Thu, 17 Jul 2014 16:46:10 +0000 (18:46 +0200)
commit15174e9a70b07f95356bf0a75887e2a02b33baab
tree1b145dc5ec316028a465305dcdc94105e941dbb4
parent68aa292f0a61b884e5be6fa403083a5650f36e9a
[IMP] base, mail: cache user.has_group() + ir.ui.menu.load*()

Loading the menus is the most expensive
operation for an average page load, and
the result does not change often.
The menu filtering already uses a separate
cache based on groups, but the rest of the
loading includes reading actions and
translating menu names, which is also
expensive.

Added a cache keyed on user + user
lang, plus relevant cache invalidation
when any of the following are touched:
access rights, user data including
groups and language, menus or mail.group
subscriptions.

The menu filtering cache is still
useful in parallel has it is invalidated
under different conditions.

User.has_group() is cheap but still
called very often, so it is an easy
win as well, and also frequently
used when rendering page templates.
addons/mail/mail_thread.py
openerp/addons/base/ir/ir_ui_menu.py
openerp/addons/base/res/res_users.py