salimfadhley/jenkinsapi — pull request #186 by wgaggioli (2013-10-21 17:28:06+00:00)
Title: Add optional polling cache to appropriate subclasses of JenkinsBase

I added an optional `poll_cache_timeout` parameter to subclasses of `JenkinsBase` because I noticed in certain circumstances the api polls the Jenkins server excessively. For example, I noticed when querying whether a Job is queued or running, the following code results in 6 http requests, when only 2 are unique:

job = Job(job_url, job_name, jenkins_obj)
busy = job.is_queued_or_running()

To prevent this, I modified the `poll` method to skip calling `_poll` if it has already been called in the last `poll_cache_timeout` seconds. By default, the cache is disabled, so it will not modify current behavior.