Monday, September 10, 2007

Declarative caching in the UI layer

In my recent post about the BestCrosswords.com architecture, I mentioned the fact that a fair amount of caching was taking place in the web UI layer. I'd like to expand on that.

The data consumed by web UI layer comes solely from the service layer. The services are injected into Tapestry components by Spring.

Let's take an example. If you look at the home page, you'll see that recently added crossword puzzles are displayed for different categories (e.g. American or British type puzzles). The Tapestry component responsible for outputting this bit of HTML uses the "constructor" (as in puzzle constructor) service, injected into the component at runtime. Since the component is located on a high traffic page, its performance needs to scale so hitting the service layer (and thus the database) on every requests is out of the question.

My first solution to this problem was to cache the service layer data in the component itself. It worked for a while but proved inflexible in the long run. For instance, depending on where a component was located (e.g. a high or low traffic page, etc), different caching strategies were needed.

My second solution (and the one I'm using now), was to configure caching proxies in Spring using Spring modules and Ehcache and inject those into the components instead of the real services. This way, I could decide to turn caching on or off depending on the specific needs of the component, without it being aware of anything.

15 comments:

Liza said...

Hi i am richa Rai working as goa escorts and for few time....

http://www.richarai.com/
Goa Escort
Escorts in Goa
Goa Escort Services
Goa female Escorts

Nisha Kapoor said...

We provide Mumbai Escorts both incalls and outcalls throughout Mumbai so call me to party, to relax or just for a massage.

Escorts in Mumbai
Independent Mumbai Escorts
Mumbai Escorts Services

Rinky Arora said...

I am Sneha Kapoor From Mumbai Escorts. A total girlfriend experience, I will wow you from the moment you open the door. I am a 25 year old top-class Independent Mumbai Escort gorgeous companion and a busty blonde glamour girl. You will find me intelligent, classy, well mannered and educated, yet down to earth with a great sense of humor. I have a bubbly personality and can talk to anyone any where,

Booking Website: http://snehakapoor.co.in/

mumbai escorts
independent mumbai escorts
mumbai escorts services
escorts in mumbai

Top Escorts Dubai Agency said...

Thanks for one’s posting! I quite enjoyed reading Your Post; you could be a Very great author. I will make sure to bookmark your blog now and will eventually come back in the foreseeable future always. I want to encourage you continue your great writing Skills, have a nice evening!
Indian Escorts In Dubai

Simran Kour said...

Lifestyle is too short to keep on remorse and unhappiness, so for those who are struggling from any kind of depressive disorders to have, obtaining the most appealing Ahmedabad Escorts Agency solutions perhaps. http://poopits.com
Ahmedabad Escorts
Escorts in Ahmedabad
Ahmedabad Escorts Agency

Kavya Rai said...

This is actually essential because as long as the Ahmedabad Independent Escorts shall keep pleased and pleased this business shall keep on growing and achieve new levels every single day. http://www.kavyarai.com
Ahmedabad Escorts
Kavya Escorts in Ahmedabad
Ahmedabad Independent Escorts

Ahmedabad Model said...

Ahmedabad Escorts genuine and passionate services help various clients to overcome grieves and depression. Visit: http://escortinahmedabad.in
Ahmedabad Escorts
Escorts in Ahmedabad
Ahmedabad Escorts Agency

Maya Pathak said...

One can go for a live chat period if the person wishes to do so before looking for a particular plan be offered by the Independent Call Girls in Ahmedabad. http://www.mayapathak.com
Maya Pathak Ahmedabad Escorts
Ahmedabad Escorts Maya Pathak
Independent Call Girls in Ahmedabad

Tanishka Oberoi said...

The Independent Escorts in Ahmedabad are also available for serving their clients with some of the classiest and most exotic in call and out call services. Visit http://www.tanishkaoberoi.com
Ahmedabad Escorts
Ahmedabad Escorts Tanishka
Ahmedabad Escorts Agency

Joya Khan said...

Escorts in Ahmedabad definitely take money to provide the services but they know that their services are premium and for that anyone is willing to pay. Visit: Visit: http://www.joyakhan.com
Joya Ahmedabad Escorts
Joya Escorts in Ahmedabad
Ahmedabad Escorts Services

Neha Nand said...

Mumbai Independent Escorts are really devoted and know how to carry out their day to day projects in an pleased manner so that they can always keep the customers can use pleased and enthusiastic about their solutions every single time. http://www.nehaanand.com
Hire Escorts in Mumbai
Mumbai Escorts Services
Mumbai Dating Escorts

Indian Beauty Queen said...

The rates and expenses associated with each of the help is based upon on the type of Ahmedabad Escorts assistance that has been selected by an personal. http://www.indianbeautyqueen.in/
Ahmedabad Escorts
Independent Escorts Ahmedabad
Hire Escorts Services in Ahmedabad

Nandita Sigh said...

We open up more and more, and at the end we started getting closer to Jaipur Escorts Girl. http://www.jaipurescorts.biz
Jaipur Escorts Girl
Female Escorts in Jaipur
Independent Escorts Services in Jaipur

maya pathak said...

Sometimes Surat Escorts stay for over a year, and they don’t want to leave our country but without money it will be hard for them to stay so long. Visit: http://www.mayapathak.com/surat-escorts.html
Surat Escorts
Surat Escorts Agency
Escorts in Surat

Maya Pathak said...

Escorts Services in Ahmedabad, Must be hot in order to lure the clients – one of the basic necessity of this job is to look hot. http://www.mayapathak.com/ahmedabad-high-profile-escorts.html
Ahmedabad Female Escorts
Escorts Services in Ahmedabad
Independent Ahmedabad Escorts