I am trying to understand Azure functions with HTTP Trigger -
Function invocations are meant to be independent from each other, so there is no way to guarantee that some code is executed only once. If your function comes under heavy load, it might even be distributed to multiple machines and they all operate independent.
However, what you can do is declare static variables in you function and they will often retain their value between invocations. Often, no guarantees!
Secondly, there is no way you can share memory between invocations. To share state, you should fall back on other storage solutions like a Redis Cache for example