Azure Functions: Singleton for expensive object : <p>I've created some very simple Azure functions. They read and write data from Couchbase (which is running in Azure on a VM).</p>

<p>I'm concerned about the connection(s) that I make to Couchbase in an Azure Function. I create a <code>Cluster</code> object each time. This is an expensive operation, and I would typically only do it once in a normal web app. But in the Azure Function, I'm <code>new</code>ing it up every time.</p>

<p>There are a lot of expensive to instantiate objects like this beyond just Couchbase. Is there way to create a singleton, or some sort of shared object that Azure Functions can reuse between calls?</p>

<ul>
<li>You can see a description of what I'm doing here: <a href="https://blog.couchbase.com/azure-functions-couchbase-server/" rel="noreferrer">https://blog.couchbase.com/azure-functions-couchbase-server/</a></li>
<li>The full source code here: <a href="https://github.com/couchbaselabs/blog-source-code/tree/master/Groves/074AzureFunctions/src/CouchbaseWithAzureFunctions" rel="noreferrer">https://github.com/couchbaselabs/blog-source-code/tree/master/Groves/074AzureFunctions/src/CouchbaseWithAzureFunctions</a></li>
</ul>
