ILIAS
ILIAS copied to clipboard
IRSS: Add micro optimizations for stakeholder database repository
If approved, this should (at least) be picked to all "upper" ILIAS versions/branches.
This PR suggests some tweaks/micro optimizations for the \ILIAS\ResourceStorage\Stakeholder\Repository\StakeholderDBRepository.
The main aspect is the switch from a SELECT + potential INSERT (one or two operations) approach to the usage of an atomic \ilDBInterface::replace. I know, if a row does exist, REPLACE deletes it and inserts the new data, in one atomic step, which should not be a problem IMO.
Why?
- The tables
il_resource_stkhandil_resource_stkh_uboth contain two fields. We could provide (and already do in theINSERT) values for all fields, which makes the use ofREPLACEapplicable and IMO (at least a tiny bit) more performant. - It is (IMO) more readable
- In general: It prevents race conditions, but of course you also address them with your locker and
\ILIAS\ResourceStorage\Lock\LockingRepository::getNamesForLocking