在ASP经典的缓存记录集? [英] Caching recordsets in ASP Classic?

查看:104
本文介绍了在ASP经典的缓存记录集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何才能最好的缓存断开ADODB在一个传统的ASP方案广泛应用记录集?

How can you best cache disconnected ADODB recordsets application wide in a classic asp scenario?

这似乎并不像它可以连接记录存储在应用程序状态,还是我失去了一些东西?

It does not seem like it is possible to store disconnected recordsets in application state, or am I missing something?

我发现<一个href=\"http://blogs.technet.com/heyscriptingguy/archive/2006/04/11/how-can-i-save-a-disconnected-recordset.aspx\"相对=nofollow>,你可以坚持如何记录集XML并加载它们的例子试,但我希望留在记忆 - 但它可能是最好的选择。

I found an example of how you can persist recordsets to xml and load them again, but I was hoping to stay in memory - but it might be the best option.

推荐答案

从技术上讲,你可以指定一个断开ADODB记录到Application对象。不过,我不会推荐它。

Technically you can assign a disconnected ADODB recordset into the Application object. However I wouldn't recommend it.

为了将对象分配到它需要自由线程的应用程序对象。一个ADODB记录是单线程的的它会在分配给应用程序对象提供一个自由线程的代理。

In order to assign an object into the application object it needs to be free-threaded. An ADODB recordset is Single threaded but it will provide a free-threaded proxy when assigned to the application object.

什么这意味着只要是一个请求需要访问记录上的要求上运行将阻止作为代理当前线程将马歇尔调用到记录在最初创建线程。如果另一个请求碰巧使用记录编组的通话将被排队。

What this would mean is whenever a request needs to access the recordset the current thread on which the request is running on will block as the proxy will marshall the call to the thread where the recordset was originally created. If another request happens to be using the recordset the marshalled call will be queued.

这样做的问题是,实际上记录的所有用途将被序列从而创建一个可伸缩性问题。只有一个请求可以在同一时间访问记录。

The problem with this is that in effect all uses of the recordset will be serialised thus creating a scalability issue. Only one request can access the recordset at the same time.

不过,事情变得更糟糕。最初创建记录的线程可以自行处理请求,在这种情况下没有什么(除了线程本身)可以不管是否实际使用记录或无法访问记录。除了在ASP调度可能仍然给该线程一个请求即使有记录的现有队列访问的线程上。

But it gets worse. The thread that originally created the recordset could itself be processing a request, in which case nothing (except the thread itself) can access the recordset regardless of whether the recordset is actually being used or not. In addition the ASP dispatcher may still give a request to the thread even though there is an existing queue of recordset accesses on the thread.

一个解决方案

不过,你得接近的解决方案。地方转换记录的内容转换成XML但不是将其保存到一个文件,将其加载到 FreeThreadedXMLDocument 。这个对象作为它的名字暗示是一个忠实地自由线程对象,它不是一个代理单线程对象。

However you have got close to the solution. Place convert the contents of the recordset into XML but instead of saving it to a file, load it into a FreeThreadedXMLDocument. This object as its name suggest is a truely free threaded object, its not a proxy to a single threaded object.

现在可以将此XML文档中同时应用对象和不同的请求访问其放置。

Now you can place this xml document in the application object and access it from various requests at the same time.

这篇关于在ASP经典的缓存记录集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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