----- Original Message ----- 
From: "seemaherein" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Friday, September 14, 2007 10:33 AM
Subject: [flexcoders] caching in Flex


> hi,
> I have a flex application which is making http service calls to java
> code. Which is executing queries on oracle database and fetching large
> no of results.

Investigate adding server code to filter/amalagamete those results to reduce 
the volume. If you are displaying data for a week, just get a weeks worth of 
data, etc.
If you can consider whether you need all the data in one chunk. If you can 
split the data and use the parts independently, you can at least give the 
end user something to look at while data is loading.
Store the returned data in a local data structure/cache. It doesn't have to 
be a local shared object.

Consider implementing a cache on the server side. That will potentially 
reduce DB queries too.

To invalidate a local client-side Flex cache, consider using a 
push-technology so that the server can inform the client that data is 
invalid and should be removed from the local cache.

Withouth a push-technology, consider invalidating the cache on the basis of 
a stale data timestamp.

Depending on how critical this is, have a client side cache in flex and a 
server side cache. The server side cache will minimise DB queries for 
multiple clients, the client side cache will minimise transfer for a 
particular client.

>
> that is very time consuming. This application is just a reporting tool
> so it doesn't make any updations to the database but only reads data.
>
> My question is that how can i implement caching in Flex so that for
> same kind of query it doesn't go to database and all.

A cache is basically a data structure to hold data ready for repeated use, 
so it's structure can be anything that you want. In the past I've made them 
by using a combination of three things:

1) a signature that represents the cache query (for example a combined 
string for a date and department number that represents a unique key for the 
data set being requested),
2) a timestamp for the query (so it can be purged when stale),
3) an object to hold the query dataset.

If the cache is interrogated with a signature not seen before, the query 
continues on to the server or database. If the signature is found, the 
dataset object is returned from the cache.

Tom has already given the simplest form of cache!

Paul

> Please help.
> thanks in advance. 

Reply via email to