Issue #4519 has been updated by Jeff Weiss.

It looks like what's in Ken's branch will always write to the cache even if the 
TTL is 0, which means we're potentially taking a filesystem write hit for 
values that explicitly aren't cached at all.

<https://github.com/kbarber/facter/commit/4e9f1a8311124c44ec6f88a38c589f0eec3073e8#L3R64>
----------------------------------------
Feature #4519: Facter should provide a convenient way to cache values
https://projects.puppetlabs.com/issues/4519#change-63534

Author: Peter Meier
Status: Accepted
Priority: Normal
Assignee: 
Category: library
Target version: 2.x
Keywords: 
Branch: https://github.com/kbarber/facter/tree/ticket/4519-cache
Affected Facter version: 


I think this have discussed already various times and it is even planned?!. But 
I couldn't find a logged ticket and as I stumpled over that problem once again 
I thought I might want to file a feature request:

Facter should provide a way to:

1. cache facts with a certain timeout, so that the fact value gets cache for 
the defined time
1. provide a way to cache any kind of data for a certain amount of time

Why? We might want to have facts that take some time to calculate, however that 
don't change much. Or there might be data required to calucate a certain fact 
which high resource intensive, but doesn't change often. So what I like to have 
is similar to the @confine@ a way to set @timeout@, so that if this is set to 
some seconds/minutes (?) the fact isn't calculated again until the timeout 
expired.

For the second point I'd like to have a simple key value store with timeout 
capability built into facter, so I can cache output of commands, which can then 
be used amongst different facts.

Example:

xen management tools are getting slower the more VMs you start. Hence @xm list@ 
can get slower and slower and if you have various facts that are depending on 
the output of that command and you take the naive approach and call @xm list@ a 
couple of times, you slowdown facter and hence puppet runs enormously. If I 
have only one fact using the output it would be nice to let facter cache that 
fact. However, if I have multiple facts depending on the output of @xm list@ I 
might want to cache also the output of @xm list@ so that @xm list@ is called 
really only once per facter run.

Currently you can do that with your own cache implementation hacked into facts, 
but I think it would be nicer if facter would provide a convenient way to cache 
things.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to