Friday, November 30, 2007

Spring modules caching in HTTP session

In a previous post, I described how I used declarative caching of my Spring beans using Spring modules. This strategy works great for caching data that is global to the application but breaks down when trying to cache user specific data. Let me give you an example.

On the site, there's a feature that allows users to save a partially completed crossword puzzles so they can be resumed later. In the service layer, I have a bean that is responsible for encapsulating that puzzle saving logic, let's call it the puzzle saving bean. One of its method returns the number of saved puzzles for a particular user. When the user is logged in, this number is displayed in the side bar as a reminder that there are puzzles awaiting completion. Since the side bar is shown on every page, the service layer is called a lot which overloads the database. This is unacceptable.

Fortunately, Tapestry allows me to solve this problem elegantly by declaring a UI component property to hold the number of saved puzzles. By giving that property session scope, it gets preserved into the HTTP session between calls. This performs great but won't work because of staleness. Let me explain. Let's say in another part of the site, the user saves a puzzle. Unless I specifically notify the component that holds the session property to discard it, the number displayed in the side bar will be wrong. Plus that notification introduces undesired coupling between two unrelated components.

So, what if instead of caching the number in the session I were to use the (global) caching version of the puzzle saving bean? That would solve the staleness problem since cached values are discarded when data altering methods are called. However, it introduces another problem. The cache gets quickly filled with user specific data and that data competes with the global data for resources. So what is the solution?

Well, it is quite simple. I liked the fact that the caching data in the HTTP session is tied in with the user's activity. If the user is idle, the data gets passivated. If the user logs out, the data gets deleted. I also liked the simplicity and the abstractness that Spring modules caching offers. So I combined both. I implemented a org.springmodules.cache.provider.CacheProviderFacade that uses the HTTP session to store the caching data. This is really ideal. I can choose to inject the global or session cached service bean, depending on the situation, and none of the code using it has to change. However, I need to carefully pick which version to inject. For instance, the UI component responsible for saving and deleting saved puzzles must use the session cached bean if I want the cached number of saved puzzles to be discarded.

I posted the code on the springmodules mailing list so feel free to take a look.


sapnasundari said...

Check our website to know more ...

Bangalore Escorts & Escorts in Bangalore

Unknown said...

If it comes to producing all ideal life which may be achieved with Queen and anal for making great times, and we're the dealer of great times in life from all range from good times to each of sensual format of earning life. We do understand the all qualification that contributes to all great times and we've brought all great times of queen to you from each corner of earning great times and carrying all of your stress aware and satisfying the joy on your lite you've been considering make on your tired and funniest life of earning work completed and we have escorts that not only understands to create all molecules to receive the very best care for making great times without creating any rush act on your lifetime with friendly and enjoyable manner you always wished to live with call girls at noida.Noida Escort

Dubai Sugar Babes said...

Dubai Sugar Babes are ultimate selection of female companions provided with all bodily pleasures, companionship to make your time a better experience and to give you the wonderful erotic pleasure to remove all the tiredness from your life. Although, there are many escort agencies in the city and out of them few are highly reputed, Dubai Sugar Babes is one such agency to get the most prominent escort services all over Dubai.
Dubai Escorts

Unknown said...

The biggest Delhi Female Escorts directory in India having Verified & Independent Indian Russian Uzbek Escort Girls for Sex Dating in Delhi.
Delhi Escorts Services

mahi said...

The biggest Delhi Female Escorts directory in India having Verified & Independent Indian Russian Uzbek Escort Girls for Sex Dating in Delhi.
Delhi Escorts

mahi said...

The biggest Delhi Female Escorts directory in India having Verified & Independent Indian Russian Uzbek Escort Girls for Sex Dating in Delhi.
Delhi Escorts

Mid Night Lover said...

Bangalore Female Escorts
Bangalore Independent Escorts
Bangalore Escorts Service
Goa Escorts Service
VIP Escorts in Bangalore
Female Escorts in Indira Nagar
Female Escorts in JP Road
Female Escorts in Vijay Nagar
Female Escorts in MG Road
Female Escorts in Koramangala

Unknown said...

Carrying on with this beautiful existence with beautiful women has been fantasies of millions yet you'll be the first in real life.
Delhi Escorts

Best escorts services said...

could you please write one more post on this topic because i got so many things here.

lucknow escorts

noida escorts
delhi escorts
Aerocity escorts
Mahipalpur escorts
Karol Bagh escort
escorts in noida
Dwarka escorts

Rani Sharma said...

If you are in Jaipur and need beautiful Call Girls in Jaipur or white skin Call Girls in Jaipur then you can simply book call girls in Jaipur from one of the best escort agency named Call Girls in Jaipur. It is No.1 premier escort agency and provide both incall or outcall facility to clients.Please click on the following link to check the official websites Call Girls in Jaipur

Unknown said...


Call Girls in Kolkata
Call Girls in Mumbai
Call Girls in Noida
Call Girls in Puri
Call Girls in Cuttack
Call Girls in Bhubaneswar
kolkata escorts
mumbai escorts
noida escorts
Puri escorts
Cuttack escorts
Bhubaneswar escorts
Call girl
kolkata call girls
mumbai call girls
noida call girls
Puri call girls
Cuttack call girls
Bhubaneswar call girls

Puja Kumari said...

Call Girls in Kolkata
Call Girls in Mumbai
Call Girls in Lucknow
Call Girls in Gurgaon
Call Girls in Bangalore
Call Girls in Guwahati
Escorts in Kolkata
Escorts in Mumbai
Escorts in Lucknow
Escorts in Gurgaon
Escorts in Bangalore
Escorts in Guwahati
Escort services
Escort services in Kolkata
Mumbai Escort Service
Escort services in Lucknow
Escort services in Gurgaon
Escort services in Bangalore
Escort services in Guwahati
Escort service
Escort Service in Kolkata
Escort Service in Mumbai
Escort Service in Lucknow
Escort Service in Gurgaon
Escort Service in Bangalore
Escort Service in Guwahati

lilighosh said...

We are having beautiful and gorgeous models in Delhi who never give up with their work and who love to visit new locations with new people around the city.

To get these services in Delhi visit here:-

Desi Call Girl

Sexy House Wife

Call Girls Whatsapp Group

New Delhi Escorts

Girls Mobile Number List

delhi escorts said...

Hi People, Pillow Pleasures escorts in delhi agency is one of the most popular escorts in delhi Service.
The Girls of we are not just awesome enough but also familiar with the art of offering best sexual service in the town.
Our Girls cannot be restricted only to provide you physical satisfaction, they can be your coach and you can discuss with her whatever you want to discuss
Choose the Girls suits your best and we will do the rest.
escorts in delhi

ankitaoberoi said...

I am ankitaoberoi Housewife Escorts in dwarka is your premier dwarka escorts service. Have you ever called an escort service in dwarka and not gotten an answer?

Dwarka Escorts,
Dwarka escorts service ,
Escorts in Dwarka ,
Faridabad escorts

internetmarketingseosmo said...

Book Online Russian Call Girls aerocity paharganj, Escorts service provides escort call girls by the escort Sonamkhana paharganj . We have selected the best high profile call girls in paharganj
paharganj escorts
paharganj escort
paharganj escorts service
paharganj escorts agency
independent paharganj escorts

ballthais said...

90minup ข่าวกีฬา ฟุตบอล ผลบอล วิเคราะห์บอล พรีเมียร์ลีก ฟุตบอลไทย

bangalore escorts said...

I think your post is very nice and great.
Escort in Faridabad
Faridabad Escort
Escorts in Faridabad
Dwarka Escorts

Bangalore Beauties said...

Banglore Escorts

Banglore Escort

Escorts in Banglore

Call girl in Banglore

Call girls in Banglore

rokcloud said...

Escorts Service in Udaipur
Escorts Agency in Udaipur

rokcloud said...

Independent Delhi Escorts
Independent Delhi Escorts
Gurgaon Escorts
Dwarka Escorts
Dwarka Escorts

needloversjaipur said...

So you know the things have upgraded so do our Jaipur Escort services, now it's not only about the intercourse and orgasm it's also included the mental satisfaction also Now we are also providing Jaipur Escort Service visit the website to know more.
Jaipur Female Escort
Jaipur Escorts
Jaipur Female Escorts
Jaipur Escort
Jaipur Escorts
Lucknow Escort Service
Agra Escort Service
Ludhiana Escort Service
Udaipur Escorts
Indore Escorts
Jodhpur Escorts
Mussoorie Escorts
India Escorts |Independent Call Girls Free Post


rokcloud said...

Aerocity Escorts
Model Escorts in Aerocity

rokcloud said...

escorts in aerocity
independent aerocity escorts
Escorts Agency in Aerocity
Call Girls in Aerocity
Escorts Service in Aerocity
Aerocity Escorts
Aerocity Call Girls

Unknown said...

Escorts in Connaught Place
Escorts in Noida
Call Girls in Ghaziabad
Escorts in Ghaziabad

Off Pages Sites List said...

Roku Com Link
Roku Com Link
HP Printer Technical Support Number

Saket Independent Escorts said...

Yamani Singh Delhi Escots | Escort Delhi | Independent Escort Delhi

Call us at : 09873777170, Hi!! I am, Yamani Singh Delhi Escorts, 23 year old an Independent Escort Girl in Delhi and a high profle and well educated, soft spoken, fluently speaking englsh, if you want to enjoy with a high class escort girls in Delhi Just book me and enjoythe best services in all 3/5 star hotels for in/out-call.

Delhi escort, Delhi escots, escort Delhi, escorts Delhi, Delhi independent escorts, independent escort Delhi.

Delhi Escorts

Off Pages Sites List said...

Creative Consultancy in Delhi
Wedding Fashion Designer in SouthEx

Ankita oberoi said...

Dwarka Escorts | Call Girl Service | Independent Escorts in Dwarka

Contact us +91-9711199171, Hello Gentleman!! I am, Ankita Oberoi, 23 years old an Independent Escort Girl in Dwarka, if you are planning to visit in Delhi, Come to Dwarka and book an appointment with me and enjoy the best services in all 3/5 star hotels for in/out-call available 24/7.

Dwarka Escorts, Escorts in Dwarka, Dwarka Escorts Service, Independent Escorts in Dwarka, Call Girl Service, Top Sexy Model, Independent Call Girl, Dwarka Escorts Service Incall & utcall, Independent Call Girls in Dwarka, Delhi.

Dwarka Escorts
Dwarka Escort Girls

mahipalpur escorts said...

mahipalpur escorts
escorts in mahipalpur
mahipalpur call girls
escort in mahipalpur

thecallgirlinnoida said...

Call Girl in Noida, Female Escorts Noida

9873777170, Hi!! I am, Kajal Sharma, 21 years old an Independent Escort Girls in Noida, and stay in 5 star hotels, if you are planning to visit Noida, Then book me and enjoy the best call girls and escorts services in all 3/5 star hotels for in/out-call for all high class people and gentleman available 24x7.

Call Girl in Noida, Noida Escorts Service, escorts service in Noida, escort girls in Noida, female escorts noida, sexy escorts noida, college girl escorts noida.

Noida Escorts

Off page activity said...

Desktop Computers: Discover All You Can These days
Desktop computer Pcs: Find out Everything You Can Today
Desktop computer Pcs: Discover All You Can Today
Desktop Pcs: Understand All You Can These days
Desktop computer Computers: Learn All You Are Able Right now
HP Printer Support
HP Printer Support
HP Printer Support
HP Printer Support

Aerocity escorts said...

Aerocity escorts
Independent escorts in Aerocity
escort in Aerocity
escorts service in Aerocity

Song PK said...

We provide Domain Registration as well as Web Hosting in Nepal that enables you to run any business online with global reach. visit Now:

alkhadim LLC said...

Where a VAT dealer ceases to carry on business, that dealer or his legal representative shall apply to the authority prescribed for vat cancellation.

rokucomlink said...

Printer Technical Support Number by
HP Printer Technical Support Number by
Dell Printer Technical Support Number by
Brother Printer Technical Support Number by
Outlook Technical Support Call 877-760-0084
Microsoft Outlook Customer Service Number by

Nisha Kohli said...

A number of them are trapped however, and difficult to get regrettably, not one of them will you phone up in a minute's notice and have on your area within seconds in Jodhpur escorts. At Girls Direct For You, we Operate with only the Best erotic Which you'll otherwise spend searching over unproductively.
Goa escorts

Nisha Kohli said...

This Is the Reason Why all our amazing escorts in Udaipur try to arrive in Fear of the unknown and privacy issues remain the very best Providing you the chance to have a nice version in your own arm and make you really feel as the only person on Earth.
Udaipur escorts

Nisha Kohli said...

Welcome to our escort service in Ahmedabad, which is top-notch! Should you be seeking discreet, well-informed wonderful and companies and are planning the trip that is next, later our partner variations that are VIP may be happy to follow along with you.
Ahmedabad escorts

labina said...

I am a housewife escort lady and available from 4:00 p.m to 7:00p.m only, just I work only two to three hours in a day, or in a week, if you are interested to book a matured escort lady for the short duration then you can see my profile thorough this link and make contact me. Recently I am working with Mahipalpur Escorts Agency so please see more information by visiting my personal website in this aspect.
Gurgaon Russian Escorts
Escort Service in Gurgaon
Russian Escorts in Gurgaon
Gurgaon Escorts
Escorts in Gurgaon
Gurgaon Escorts Service
Mahipalpur Escorts Service
Escorts in Mahipalpur
Escort Service in Mahipalpur
Mahipalpur Russian Escorts
Russian Escorts in Mahipalpur
Mahipalpur Hotel Escorts
Escort Service in Mahipalpur Hotels
C P Escorts
CP Escorts
Connaught Place Escorts
Connaught Place Russian Escorts
Delhi Airport Escorts
Escorts in Delhi Airport
Aerocity 5 Star Hotel Escorts
Aerocity 5 Star Hotels Escorts
Escorts in Aerocity Hotels
Gurgaon Sector 21 Escorts
Escorts in Sector 21 Gurgaon

Neha Khan said...

Mizoram University BA 1st Year Result

MZU BA 2nd Year Result

Mizoram University BA 3rd Year Result

SEO Service Noida said...

seo agency in noida have many dedicated SEO Excutive that are best in giving the best SEO Services in noida.

Loin of punjab said...

The sexual pleasures which are often sought after by most of the persons are the ones which are rightly available there for different kinds of persons. Ludhiana escorts are great when it comes to entertaining men. If you have been thinking of going to a party or a special event outdoors, you can hire one of these call girls in Ludhiana as your arm candy for the trip or event.
Ludhiana escorts
udaipurescort service
Gurgaon escorts
Jodhpur escorts
Noida escorts
Dehradun escorts

Loin of punjab said...

All our Nainital escort service are well mannered, gracious and attentive and will treat you with the most extreme admiration. We ask that you treat them in the same way. We will admire your remarks on any piece of the services given by us. Their complexion is whitish and their buttery skin is something that makes men craving for them.
Nainital escort service
Goa escorts
Jaipur escorts
Mumbai escorts
Pune escorts

Chitra Krishnan said...

bangalore call girls

bangalore escorts

call girls in chennai

chennai escort

vadodara call girls

pune call girls

call girls in hyderabad

goa call girls

kerala independent escorts

Jay said...





Loin of punjab said...

The sexual pleasures which are often sought after by most of the persons are the ones which are rightly available there for different kinds of persons. Ludhiana escorts are great when it comes to entertaining men. If you have been thinking of going to a party or a special event outdoors, you can hire one of these call girls in Ludhiana as your arm candy for the trip or event.
Ludhiana escorts
udaipurescort service
Gurgaon escorts
Jodhpur escorts
Noida escorts
Dehradun escorts

sonalisinha said...

Hi Guys, I am Sonalisinha independent Saket Escorts provide high class Saket Escorts services connect me at any time in over all Saket.9873777170
escorts in Saket
Saket female escorts
Saket Escorts
Saket Escorts Service
Independent Saket Escorts

Robert Wilder said...

Thanks for sharing this nice blog. Best Internet Plans for you depends on the available Internet providers in your area. So utilize your Zip code to figure out the customized Internet plans for your location. Consider your monthly budget and the devices you’re gonna use the Internet. Navigate to our web page or call us to know about the customized Internet plans for your needs! said...

Call Girls in Gurgaon
Call Girl in Gurgaon
Call Girls Gurgaon
Call Girl Gurgaon
Call Girl Gurgaon Service
Call Girls Gurgaon Service
Call Girl in Gurgaon Service
Call Girls in Gurgaon Service
Best Call Girl Gurgaon
Best Call Girls Gurgaon
VIP Call Girls Gurgaon
VIP Call Girl Gurgaon
Gurgaon Call Girl
Gurgaon Call Girls
Russian Call Girls Gurgaon
Russian Call Girl Gurgaon
Call Girls in Dwarka
Call Girl in Dwarka
Call Girls Dwarka
Call Girl Dwarka
Call Girls in Haridwar
Call Girl in Haridwar
Call Girls Haridwar
Call Girl Haridwar
Call Girls in Noida
Call Girl in Noida
Call Girls Noida
Call Girl Noida
plumbing company Toronto
plumbing company Mississauga
Call Girls in Gurgaon | Call Girls Gurgaon | Call Girl Gurgaon | Call Girl in Gurgaon


Our Delhi Escorts allow you to fly on our Independent connections. You can have short time relationships here. Why delay, start your journey to seek heavenly.

gyaan said...

If You are looking for something different, then I am ready. Escorts in Ajmer. I am well educated, have an open mind and have the girlish charm that Is fun and easy to be found. You will always find me smart, clean and fresh as I am very conscientious about my hygiene and I expect all my clients to reciprocate in the same manner. Check our other Services...
Call Girls in Ajmer
Russian Escorts in Agra
Hi Profile Call Girls in Jaipur
Russian Call Girls in Pune

Koka Queen said...

Thank you for your article. it gives us immense knowledge. Body massage brings you total relaxation to your body.i would like to recommend everybody to go for massage for ultimate relief once a week. Not only will it give you relief but it will also increase your productivity.

escorts near me

call girls near me

Jaipur call girls

Jaipur Escort

casinoxo said...

เกมส์ดีๆ สล็อตออนไลน์ live22 2020

Riya Mittal said...

If you are very much romantic, then give a try to Gurgaonlocal Call girls. They are extravagant to offer some fantastic time for the man. To zest things, pick any call girl and go for a dinner date to any high-class restaurant at old Market, Panjim Gurgaon Escorts Service
Escorts in Gurugram
Surajkund Escorts
Gurgaon Housewife Escorts
South City Escorts
South City 1 Escorts
South City Escorts
Sushant Lok 2 Escorts
Sushant Lok 1 Escorts
Sushant Lok Escorts
Dlf Phase 2 Escorts
Dlf Phase 3 Escorts
Dlf Phase 5 Escorts
Dlf Cyber City Escorts
Dlf Phase 1 Escorts
Dlf Phase 4 Escorts
Manesar Escorts
Golf Course Road Escorts
Golf Course Estension Escorts
Kendriya Vihar Escorts
MG Road Escorts, Gurgaon
Udyog Vihar Escorts
Escorts in Palam Vihar
Sohna Road Escorts Gurgaon