summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/cacher.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fixing a bunch of warningsLuke Kanies2009-06-031-1/+1
| | | | | | This commit should have no functional effect. Signed-off-by: Luke Kanies <luke@madstop.com>
* Changing Puppet::Cacher::Expirer#expired? method nameLuke Kanies2009-05-281-2/+2
| | | | | | | | | This method name clashed with Puppet::Indirector::Envelope#expired?, and its name wasn't actually very appropriate. The new method name is 'dependent_data_expired?'. Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing #2288 - fixing the tests broken by my attr_ttl codeLuke Kanies2009-05-221-0/+1
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding TTL support to attribute cachingLuke Kanies2009-05-201-4/+34
| | | | | | | | | Previously you had to have an Expirer, but now you can declare a TTL for a cached attribute and it will be expired automatically when the cached value is older than the ttl. Signed-off-by: Luke Kanies <luke@madstop.com>
* Supporting a nil expirer on cacher objects.Luke Kanies2008-12-181-1/+8
| | | | | | | | | | This works for those classes like Puppet::Type that use an expirer that isn't always present (they use their catalog as an expirer). The behaviour is now that if there is no expirer, expire() is a no-op and all data is considered expired all the time, so it's always fresh. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding caching support to parameters, and using cached attributes for file ↵Luke Kanies2008-11-111-0/+6
| | | | | | | | | source and metadata. As hoped, this drastically simplifies the code around retaining this data. Signed-off-by: Luke Kanies <luke@madstop.com>
* Allowing a nil expirer for caching classes.Luke Kanies2008-11-111-1/+2
| | | | | | | If there's no expirer, then the value is regenerated every time. Signed-off-by: Luke Kanies <luke@madstop.com>
* Refactoring the Cacher interface to always require attribute declaration.Luke Kanies2008-11-111-64/+43
| | | | | | | | | | | | | | | Previously you could dynamically use cached values, but the new interface requires a single static declaration of the attribute: cached_attr(:myattr) { my_init_code() } This is cleaner, because it makes it easy to turn the code into an init method and generally makes the whole thing easier to think about. Most of this commit is going through the different classes that already using the Caching engine. Signed-off-by: Luke Kanies <luke@madstop.com>
* Changing the Cacher.invalidate method to Cacher.expire.Luke Kanies2008-11-111-4/+8
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Fixing a critical bug in the Cacher module.Luke Kanies2008-11-111-13/+27
| | | | | | | | | | | | | | Basically, the first generated value was always considered expired the next time it was asked for. The fix was to create an initial timestamp in the Cacher module, thus providing a floor for validity. This is definitely a murky bug, and is especially hard to test. Also refactoring the internals just a bit. Signed-off-by: Luke Kanies <luke@madstop.com>
* Adding comments to Puppet::Util::CacherLuke Kanies2008-10-151-2/+26
| | | | Signed-off-by: Luke Kanies <luke@madstop.com>
* Using the new Cacher class for handling cached data.Luke Kanies2008-05-131-8/+10
| | | | | This provides a single, global bit for determining whether a given piece of cached data is still valid.
* Adding a module for handling caching information.Luke Kanies2008-05-071-0/+67
I keep having issues with integration tests keeping cached values around, and this module should hopefully give us a single place to invalidate all caches, thus making testing this much easier.