HomePhorge

Initial implementation of a "cache accumulator" behavior.
75f1923049d5Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Initial implementation of a "cache accumulator" behavior.

Mix Puppet::Util::CacheAccumulator into an ActiveRecord-like class, and then for any
attribute in that class on which you are likely to call find_or_create_by_*, specify:

accumulates :foo

and instead of :find_or_create_by_foo use :accumulate_by_foo.

The class will cache known results keyed by values of :foo.

Do an initial bulk-lookup: class.accumulate_by_foo('foo1', 'foo2', 'foo3', 'foo4')

Details

Provenance
Ethan Rowe <ethan@endpoint.com>Authored on
James Turnbull <james@lovedthanlost.net>Committed on Apr 22 2009, 6:39 AM
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUbab45c4a3006: Saving rails resources as I create them, which saves about 10%
Branches
Unknown
Tags
Unknown

Event Timeline

James Turnbull <james@lovedthanlost.net> committed rPU75f1923049d5: Initial implementation of a "cache accumulator" behavior. (authored by Ethan Rowe <ethan@endpoint.com>).Apr 22 2009, 6:39 AM