Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
storing a query in the Application scope ...is this a bad thing?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Martin  
View profile   Translate to Translated (View Original)
 More options 8 Sep, 12:34
From: Martin <martinwjo...@aol.com>
Date: Tue, 8 Sep 2009 04:34:00 -0700 (PDT)
Subject: storing a query in the Application scope ...is this a bad thing?
Bottom line - I have a simple "select all" query that returns about 30
rows of simple data and doesn't really change very often.
However ...it does this by pulling the results from other queries that
read data from different XML datasets and joining them together into a
more useful object.
This query gets called a LOT - and I mean a LOT - so to improve
performance, and because the data doesn't change very often, I decided
to stor the results in the application scope.

eg <cfset application.mydata = application.queryCFC.getAllMyData() />

The results have been that what was taking up to ~600ms before is now
done in ~47ms.

This is a small web app so I am happy I can do this. I just wonder if
this is a bad habit to get into?

--------------------------------------------------------------------------- -----------------------------
More detail - why I did it.

We have lots of short lived, simple web projects - "summer schools"
being one example - they all want their own  design and live in a
range of different domains (and sub-domains). Once or twice we even
have to move the app from one domain to another so I wanted to build
simple self contained projects that I could just pick up and dump
elsewhere if needed.
Our existing database is filling up with these temporary projects so
while I search for an effective conference(?) management system (x-
domain). I thought I would experiment with storing data in XML.
So far I quite like it - I am trying to engineer the apps in a MVC way
so if I want to create a new one all I need to do is delete my XML
files, edit the config file and create my design.
I have found reading the XML files a bit more time consuming than
straight db queries though - especially when joining data from
different files.

The above performance boost example was on one problematic page that I
probably needed to re-engineer anyway however this was a simple and
quick solution that I was able to implement very easily.

--------------------------------------------------------------------------- ----------------------------------------------------

Is anybody else using XML to store data? I am especially interested to
see how other people store dates in XML. Just curious.

Cheers
Marty


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gareth Cole  
View profile   Translate to Translated (View Original)
 More options 8 Sep, 12:48
From: "Gareth Cole" <gareth.c...@esus.ie>
Date: Tue, 8 Sep 2009 12:48:07 +0100
Local: Tues 8 Sep 2009 12:48
Subject: RE: [SCFUG] storing a query in the Application scope ...is this a bad thing?
That sounds a good way of doing things to me.

If you want the coldspring-style answer though, you may want to abstract
calls for the query.

I'm assuming that your code will have lots of references to
application.mydata - what happens if you want to re-engineer things in the
future? You have to update all these references.

Instead, set up a service cfc that has a function to return your query. You
can then manage this service with Coldspring. So on your front-end code, you
might just be calling cs.getBean('myService').getAllMyData()

Internally, your service may just be storing the query in the application
scope, but the rest of your application doesn't need to know this. In
future, you could change the way your service works internally, and your
front-end code doesn't change at all.

It can take a while to get your head around the benefits of coldspring, but
it's great when you start using it. It makes your code a lot more reusable


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google