buildbot/buildbot — pull request #1125 by andrewjcg (2014-04-06 01:37:34+00:00)
Title: Add `set` method to LRUCache objects

This provides a way to insert an object into the cache.
`put` wasn't sufficient for this as it appeared to only
behave as a "touch" method (e.g. if the item wasn't already
in the cache, it was a noop).

This is useful to provide a way to "seed" the various caches.
In a number of locations we construct items and put them in
the DB, only to immediately load them back. We already have
caches around these DB accesses to avoid multiple "gets"
actually hitting the DB, but we can avoid the initial "get"
missing in many cases by seeding the associated cache when
we put the item into the DB.

An example of this is chrdicts and the chrdict cache, where
it's common to call `addChange` followed by `getChange`.
This results in two DB accesses when it really only needs to
be one.