On 2016-04-12 12:16, Robert Sandell wrote: > Just annotate any class with @Extension and Jenkins will instantiate it as > a singelton and manage it's lifecycle. You can get it via > ExtensionList.lookup(YourClass.class) > > And for good measure annotate it with @Restricted(NoExternalUse) to hinder > other plugins from using it.
Thanks Robert. It helped me a lot. Btw, people looking in the future for in memory cache solutions (and reading that post) may be interested in Guava and its cache solution: https://github.com/google/guava/wiki/CachesExplained Marcin > > /B > > On Tue, Apr 12, 2016 at 9:56 AM, Marcin Zajączkowski <msz...@wp.pl> wrote: > >> On Monday, April 11, 2016 at 6:29:59 PM UTC+2, Marcin Zajączkowski wrote: >>> >>> Hi, >>> >>> In the plugin implemented as Notifier (Rundeck plugin) I would like to >>> add global cache (one, available for every job using that plugin) to not >>> make the same REST call for various jobs (which on a Jenkins instance >>> hundreds of jobs increase startup time slightly). >>> >>> Is there any mechanism (a place) in Jenkins which I could use to store >>> those cached values? If not what is a preferred solution to implement cope >>> with it? >>> >> >> As In fact it is only needed when jobs are parsed at the Jenkins startup >> (RundeckJobProjectLinker)Action is created for every build in the history, >> so the requirements can be simplified to make it available only on master >> (no need to propagate across slaves) and it can be transient (rebuilt on >> reset). Static ConcurrentHashMap in that class would be probably the >> easiest implementation, but it smells bad. Maybe there is a storage in >> Jenkins to keep those shared values? >> >> Marcin >> >> >> >>> >>> Marcin -- http://blog.solidsoft.info/ - Working code is not enough -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/571A90B2.9060308%40wp.pl. For more options, visit https://groups.google.com/d/optout.