C# Windows Azure QueueClient推荐的缓存?

C# Windows Azure QueueClient推荐的缓存?,c#,azure,azure-queues,C#,Azure,Azure Queues,刚刚创建了一个新的工作者角色来处理来自队列的消息。这方面的默认示例在开头包括以下代码: // QueueClient is thread-safe. Recommended that you cache // rather than recreating it on every request QueueClient Client; 有人能详细说明演示附带的注释吗?不要每次都创建新实例。只创建一个实例,然后使用它 //don't this public class WorkerRole :

刚刚创建了一个新的工作者角色来处理来自队列的消息。这方面的默认示例在开头包括以下代码:

// QueueClient is thread-safe. Recommended that you cache 
// rather than recreating it on every request
QueueClient Client;

有人能详细说明演示附带的注释吗?

不要每次都创建新实例。只创建一个实例,然后使用它

//don't this
public class WorkerRole : RoleEntryPoint
{
    public override void Run()
    {
        // This is a sample worker implementation. Replace with your logic.
        Trace.TraceInformation("WorkerRole1 entry point called", "Information");

        while (true)
        {
            QueueClient Client = new QueueClient();
            Thread.Sleep(10000);
            Trace.TraceInformation("Working", "Information");
        }
    }
}

//use this
public class WorkerRole : RoleEntryPoint
{
    public override void Run()
    {
        // This is a sample worker implementation. Replace with your logic.
        Trace.TraceInformation("WorkerRole1 entry point called", "Information");

        QueueClient client = new QueueClient();

        while (true)
        {
            //client....
            Thread.Sleep(10000);
            Trace.TraceInformation("Working", "Information");
        }
    }
}

奇怪-这就是他们如何给出开箱即用的例子+这个评论。。。所以我猜我很好。谢谢