Azure如何维护APPLICATION状态? [英] How can Azure maintain APPLICATION state?

查看:111
本文介绍了Azure如何维护APPLICATION状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Azure如何保留SESSION状态-我已经在我的应用程序中使用基于Neil MacKenzie的 Microsoft Windows Azure开发指南的AppFabric实现了它.但是,基于AppFabric的方法显然不能保留我的应用程序需要的APPLICATION状态(例如 Application ["name"] = MyObject ).

I know how Azure preserves SESSION state -- I've implemented it in my app using AppFabric based on Neil MacKenzie's Microsoft Windows Azure Development Cookbook. However, that approach based on AppFabric apparently does not preserve APPLICATION state (e.g. Application["name"] = MyObject ), which my app needs.

我怀疑我将需要使用Azure表,但这将需要重新编码.因此,在走这条路之前,我想知道是否存在一种更简单的方法来保存应用程序状态,最好是不需要对我的应用程序进行编码的方法.

I suspect I will need to use Azure Tables, but that will require recoding. So before going down that path, I'd like to know if there is a simpler approach to preserve application state, preferably one that does not require recoding of my app.

谢谢

账单

推荐答案

对不起,没有什么比直接替换Application [key]方法更重要了.

Sorry, there's nothing like a direct replacement for the Application[key] approach.

您最好的选择是使用 Azure缓存.我认为,您已经在使用上本书中的Session状态方法来间接使用Azure缓存.

Your best bet would be to use Azure caching. You're already using Azure caching indirectly I believe, using the approach from the book above for Session state.

不利的一面可能是缓存的内容不会永远存在,它们的最长寿命约为72小时.因此,无论何时访问缓存的项目,都必须进行类似于下面的伪代码的测试:

The downside perhaps is that cached items don't stay around forever, their max life is about 72 hours. So anytime you access a cached item, you'll have to test similar to the psuedo code below:

object o = cache.Get("MyItem"); 
if (o != null){ 
   MyType myType = (MyType) o; 
   //use the item
} 
else 
{  
//recreate the item 
}

这篇关于Azure如何维护APPLICATION状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆