简体   繁体   English

缓存在Flex Web应用程序中如何工作?

[英]how does caching work in flex web application?

I'm new to Flex and want to learn about how to implement client-side caching for data that is repeatedly requested from the server. 我是Flex的新手,想了解如何为服务器重复请求的数据实现客户端缓存。

Let's focus on a simple example to discuss caching. 让我们集中讨论一个简单的示例来讨论缓存。 Take a Flex application having several screens, where each screen plots a line series (of x and y data). 以一个具有多个屏幕的Flex应用程序为例,其中每个屏幕绘制一个线系列(x和y数据)。 The user can switch between the screens, and each time a screen is visited or re-visited, numerical arrays for both x and y data are requested from the server. 用户可以在屏幕之间切换,并且每次访问或重新访问屏幕时,都会从服务器请求x和y数据的数字数组。 The values of the x and y data on the server, of course, never change. 当然,服务器上的x和y数据的值永远不会改变。

I want to learn what techniques are available that could be used to implement caching in the browser or AIR application such that once the x and y data is downloaded the first time, the application pulls these arrays from cache when re-visiting this screen in the future. 我想了解可用哪些技术来实现浏览器或AIR应用程序中的缓存,以便首次下载x和y数据后,应用程序在重新访问该屏幕时会从缓存中提取这些数组。未来。

How is this done? 怎么做?

Well it depends on what you want to cache. 好吧,这取决于您要缓存的内容。 Swf's are cached by the browser. SWF由浏览器缓存。 So swfs are not downloaded each time the browser points to your site. 因此,每次浏览器指向您的站点时,不会下载swfs。 If you want to remember what the user typed before on a screen or autocomplete or just cache non-sensitive data you could use a SharedObject. 如果您想记住用户之前在屏幕上键入的内容或自动完成的内容,或者只是缓存不敏感的数据,则可以使用SharedObject。 And then there's always the traditional way of storing the data you retrieve from the server in an ArrayCollection or some other object in memory and refer to it multiple times. 然后,总是有传统的方式将从服务器中检索到的数据存储在ArrayCollection或内存中的其他对象中,并多次引用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM