(Bug1353802) Remember and reuse last db_format_timestamp output if poss.

This patch adds support for remembering the last parameter used
by ArtefactType::commit to db_format_timestamp and the output of
the function, and reusing the output if the input is the same on
the next call.

In a test import of 2000 users, this patch reduced the number of
invocations of db_format_timestamp from 80,000 (3.6s) to 14,800
(.3s).

Change-Id: I6f5575f9d3649ff53514f9927744a01966d103dd
Signed-off-by: Nigel Cunningham <nigelc@catalyst-au.net>
Merge "(Bug1353802) Remember and reuse last db_format_timestamp output if poss."