[Buildbot-commits] [buildbot/buildbot] 381a20: Change semantics of `put` method for LRUCache obje...

GitHub noreply at github.com
Wed Apr 9 02:37:15 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/buildbot/buildbot
  Commit: 381a2020b071aa91470c7cb1bbbdc09575414402
      https://github.com/buildbot/buildbot/commit/381a2020b071aa91470c7cb1bbbdc09575414402
  Author: Andrew Gallagher <agallagher at fb.com>
  Date:   2014-04-07 (Mon, 07 Apr 2014)

  Changed paths:
    M master/buildbot/test/fake/fakemaster.py
    M master/buildbot/test/unit/test_util_lru.py
    M master/buildbot/util/lru.py
    M master/docs/developer/utils.rst

  Log Message:
  -----------
  Change semantics of `put` method for LRUCache objects

This changes the `LRUCache.put` method to provide a general
way to insert an object into the cache.  Previously,
`LRUCache.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.


  Commit: 271c1df0111e5453f3d7247d3df4bcd2786b6437
      https://github.com/buildbot/buildbot/commit/271c1df0111e5453f3d7247d3df4bcd2786b6437
  Author: Dustin J. Mitchell <dustin at buildbot.net>
  Date:   2014-04-08 (Tue, 08 Apr 2014)

  Changed paths:
    M master/buildbot/test/fake/fakemaster.py
    M master/buildbot/test/unit/test_util_lru.py
    M master/buildbot/util/lru.py
    M master/docs/developer/utils.rst

  Log Message:
  -----------
  Merge andrewjcg/buildbot:cache_set (PR #1125)


Compare: https://github.com/buildbot/buildbot/compare/135f646e938e...271c1df0111e


More information about the Commits mailing list