HomePhorge

Rework Puppet::Util::Cacher to only expire using TTLs
49d1e9da1381Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Rework Puppet::Util::Cacher to only expire using TTLs

We have removed every usage of cached_attr in which the attribute needs to be
manually expired. Thus, the only meaningful behavior provided by
Puppet::Util::Cacher is expiration based on TTLs. This commit reworks the
cacher to only support that behavior.

Rather than accepting an options hash, of which :ttl is the only available
option, cached_attr now requires a second argument, which is the TTL.

TTLs are now used to compute expirations, which are stored and used for
expiring values. Previously, we stored a timestamp and used it and the TTL to
determine whether the attribute was expired. This had the potentially
undesirable side effect that the lifetime of a cached attribute could be
extended after its insertion by modifying the TTL setting for the cache. Now,
the lifetime of an attribute is determined when it is set, and is thereafter
immutable, aside from deliberately re-setting the expiration for that
particular attribute.

Reviewed-By: Jacob Helwig <jacob@puppetlabs.com>
(cherry picked from commit d198fedf65e472b384666fc9ae3bef487852068a)

Conflicts:

spec/integration/node/facts_spec.rb
spec/unit/node_spec.rb

Details

Provenance
Nick Lewis <nick@puppetlabs.com>Authored on
Jacob Helwig <jacob@puppetlabs.com>Committed on Aug 19 2011, 10:52 PM
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU9849d565ec4d: Remove use of Puppet::Util::Cacher in Puppet::SSL::Host
Branches
Unknown
Tags
Unknown

Event Timeline

Jacob Helwig <jacob@puppetlabs.com> committed rPU49d1e9da1381: Rework Puppet::Util::Cacher to only expire using TTLs (authored by Nick Lewis <nick@puppetlabs.com>).Aug 19 2011, 10:52 PM