On Saturday, September 8, 2012 5:31:06 PM UTC-5, Krzysztof Wilczynski wrote: > > Hi, > > Since functions run on the Puppet Master side, the simplest solution is to > cache the value if its "freshness" is not mandatory i.e. does not change, > lets say every 5 minutes? Or, even it will be fine every 24 hours, etc ... > > Consider this snippet: https://gist.github.com/3680388 > > Let me know if you have troubles adapting this for your function, I am > always keen to help :) >
And one form of caching the result would be to assign it to a class (or global) variable. A class variable make sense to me, as you should have exactly one class responsible for actually running the function and assigning the result anyway. That's about as simple as you can do, and it would get you one function call per catalog compilation. Caching the result outside of Puppet would allow you to reduce the number of function calls further. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/jdso_mjLjogJ. 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-users?hl=en.
