Take the 2-minute tour ×
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It's 100% free, no registration required.

I have an event that retrieves information from Publication Metadata. I would like to cache this information so that I don't need to access the Publication object each time. I see that the ContextVariables allow me to pass information between events. Can I use this for caching? If not, any alternative ways to cache information to re-use?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

I tend to use a static Dictionary in a config class. I think (at least in 2013+ versions) that this should persist for the lifetime of the parent CMS process (typically core service, but could be publisher etc.). Context variables are probably only persisting for the execution of a (chain of) event(s), so will be wiped between separate actions that trigger new events

share|improve this answer
1  
A static Dictionary is a nice one, I mostly use readonly variables which I set in the constructor, see my ECL Stub Component Event Handler –  Bart Koopman Jul 31 at 12:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.