Is Run call multi-thread safe? #117
Answered
by
adoconnection
praveen-ramesh
asked this question in
Q&A
-
If we use the caching technique recommended here , the compiledTemplate.Run will encounter concurrent execution as our code is deployed in a multi-threaded environment. So, is the Run method multi-thread safe? Has it been heavily tested against in such an environment? |
Beta Was this translation helpful? Give feedback.
Answered by
adoconnection
Aug 19, 2022
Replies: 1 comment
-
Hi, yes, Run is thread safe. It was not heavily tested by me, but it is supposed to be thread safe by design. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
praveen-ramesh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, yes, Run is thread safe. It was not heavily tested by me, but it is supposed to be thread safe by design.
Run will create new
IRazorEngineTemplate instance
for each call, thus it is safe to call Run by multiple threadsRazorEngineCore/RazorEngineCore/RazorEngineCompiledTemplate.cs
Line 92 in ce41fff