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.

76 comments:

sapnasundari said...

Check our website to know more ...

Bangalore Escorts & Escorts in Bangalore

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
http://www.asiapari.com/

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

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
======================

Call Girls in Kolkata
Call Girls in Mumbai
Call Girls in Noida
Call Girls in Puri
Call Girls in Cuttack
Call Girls in Bhubaneswar
========================
Escorts
========================
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
======================
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

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

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...

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

Off Pages Sites List said...

Creative Consultancy in Delhi
Wedding Fashion Designer in SouthEx

Off page activity said...

PC COMPUTERS: FIND OUT ALL YOU ARE ABLE TODAY
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

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:https://buydomaininnepal.com/

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.

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

Admin 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

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

LOVELY RIMA said...

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
https://www.slotxd.com/live22

Anaminka said...



If You are looking for something different, then I am ready. Russian Escorts in AerocityI 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...
Escorts Service in Mahipalpur
Escorts Service in Mahipalpur
Call Girls in Mahipalpur
Russian Escorts in Mahipalpur
Russian Call Girls in Mahipalpur
Russian Escorts in Mahipalpur

Gisela said...

Thank you for sharing your idea. It’s great:D

Agen Ceme Online
Agen Poker Online

Agen BandarQ Online
Agen Sakong Online

Agen Slot Game Online
Agen Live Casino Online

Agen BandarQ Online
Agen Sakong Online

Agen BandarQ Online
Agen Sakong Online

Agen Ceme Online
Agen Poker Online

Agen Blackjack Online
Agen Domino Online

ID HACK
Cheat Poker Online

ID PRO SLOT
Cheat Slot Game

Rihana Khan said...

Here you will surely get the sexy to be your partner for the night. Our Gurgaon Escorts Service is known for hard-core sensual Gurgaon Escorts
Escorts in Gurgaon
Gurgaon Escorts Service
Escorts Service in Gurgaon
Gurgaon Escorts Agency

patsm00re18 said...

Just explore and download free Subway Surfers online game in this category! Try this game now

POOJA said...



Our Female Escorts in Aerocity have smooth bodies that can prepare you for a night of sexual loving. You don’t want to feel self-conscious as you’re safe here at our Call Girls agency. Our Services are all-time service that is accessible for you 24*7 hours. Our Escorts Girls are always prepared to make you fill you’ll have a fantastic alluring night with our lovely girls and you only need for believing simultaneously. Check our other Services also...
Female Escorts in Aerocity
Escorts Service in Aerocity
Call Girls in Mahipalpur
Escorts Service in Mahipalpur
Escorts Service in Mahipalpur


Escort Service said...

If you are in Alwar and you are looking for Alwar call girls, then we are ready to serve people like you for 24/7 hours and we have beautiful and sensual girls who can contact us by visiting our website.Call Girls In Alwar

gurgaon escort said...

When it comes to dating professional Call Girls In Delhi With Photo and Mobile Number, there are many aspects which you should consider as escort dating is not as simple as it seems. Needless to mention, it is more about having erotic fun with the Cheap Girls.Female Escort in Delhi With Photo

mumbaigirls said...

Want to experiment pleasure and excitement in life? We have the perfect answer to your imagination! Enjoy the warm company of Call Girls in Delhi With Photo and take your senses to a new level of pleasure. When it comes to providing best Delhi girls, Mobile no one does it better than us. Delhi Escorts With Photos

Babita Roy said...

Beautiful Post thanks for sharing this I am Babita from Delhi Know more about me visit website
Babita Escorts
Hyderabad Call girls escorts

Banjara Hills Call girls escorts

Ameerpet Call girls escorts

Begumpet Call girls escorts

Kolkata Call girls escorts

Mumbai Call girls escorts

Chennai Call girls escorts

Delhi Call girls escorts

Escorts In Lahore said...


Sexy Intelligent Hot Female Night Service In Best Hotels Pakistani escorts service in Lahore Top Dancer And Model 💃

hi all friends call girls in Lahore I am madam dolly provided best VIP hot sexy new call girls in pakistan karachi lahore rawalpindi islamabad

I love this Topic I serach this one for many time butt now i see this Lahore Escorts we offer you best Escorts service in Lahore
Lahore Call girls +92 3053777077 Miss leena provider best vip escorts service in lahore.
Escorts in Lahore is the best key word to search call girls in pakistani Lahore
we serve best and VIP escorts in Islamabad also.
call girls in pakistani Lahore
pakistani call girls
pakistani escorts service
call girls in Lahore ❤️







nilila said...

blognewstime
pussy888gm

nilila said...


saking789 การเงินมั่นคง เรากล้าจ่ายมากที่สุดในไทย

Anonymous said...

THANK YOU FOR VISITING MY WEBSITE:-
russian escorts in gurgaon
housewife escorts in gurgaon
gurgaon escort services
gurgaon escorts
escorts in gurgaon
escort services in gurgaon
gurgaon call girls
call girls in gurgaon

Anonymous said...

HANK YOU FOR VISITING MY WEBSITE:-
escorts in lucknow
lucknow escorts
call girls in lucknow
escort service in lucknow
russian escorts in lucknow
lucknow escort services
lucknow call girls

govt job said...

Mzu BA 3rd year Result

Tripti Goyal said...

Hii am Tripti Goyal Enjoy a full erotic service with independent Faridabad escorts service contact us for more detail. A wide scope of alluring self-ruling Faridabad escorts agency are set up to impact you to feel charming. Just enroll the right accessories and engage in sexual relations with their figure. Thusly, it would be more straightforward for you to loosen up surprising activities and have some good times. 
Faridabad escorts agency
surajkund escorts service
Independent ballabgarh escorts

Tina Rawat said...

All our call girls in Nehru place give their services in three bundles that are entirely period based generally. It just suggests that you'll have customized and modified sessions according to you might want and need. Individuals who might want one thing fabulous in life will pick their entire night bundle that continues furnishing you with conclusive delight the aggregate night.
Nehru Place escorts agency
Connaught Place escorts agency

Aerocity Escorts said...

The greater part of the Escorts in Aerocity under this classification has an incredible character with great relational abilities. They can stir up with you in a brief timeframe to turn into a genuine sweetheart. You can not just have them for a total private sensual meeting, rather you likewise can impart your sentiments and contemplations to them. Genuine nourishment for your body, brain, and soul.

Aerocity escorts agency
Aerocity escorts agency
Aerocity escorts agency
Aerocity escorts agency
Aerocity escorts agency

Aditi Dangayach said...

It was very useful to read this blog. Thank you for sharing such valuable contents.
Check out our blogs.
SEO Expert,Jaipur

Bangalore Beauties said...

Bangalore Escorts
Fresh Escorts Bangalore
Verified Escorts Bangalore
Model Escorts Bangalore
Air-Hostess Escorts Bangalore

Angels Of Bangalore said...

Bangalore Escorts
Houseeives Escorts Bangalore
College girl Escorts Bangalore
Model Escorts Bangalore
Air-Hostess Escorts Bangalore

Lonely Desires said...

You are most welcome in the world of Bangalore’s exotic escorts. Of course, today you are going to see a collection that will make you lively and hearty.
Bangalore Escorts
Housewife Escorts Bangalore
College girl Escorts Bangalore
Model Escorts Bangalore
Air-Hostess Escorts Bangalore
Independent Escorts Bangalore
Russian Escorts Bangalore

Mumbai Escorts ( Sneha Singh ) said...

Mandi Escorts
Shimla Escorts
Anantag Escorts
Bandipore Escorts
Doda Escorts
Ganderbal Escorts
Jammu Escorts

Vadodara Escort said...

The escorts in Vadodara will be the ideal decision in the event that you are getting them in right manner.
Vadodara Escorts
Vadodara Escort
Vadodara Escort Services
Vadodara Call Girls
Vadodara Independent Escort
Vadodara Model Escorts
Vadodara Young Girls Escorts

Escorts Service in Delhi said...

russian escorts in aerocity
housewife escorts in gurgaon
housewife escorts in gurgaon
housewife escorts in gurgaon
russian escort gurgaon

Gamer Man said...

:)

Unknown said...

Very useful info! Thank you for the information!
Casino Games

Unknown said...

I'm really impressed by this post. Thanks for sharing this information in this article!
Silet Poker

angela said...

เทคนิคสำหรับการเล่นสล็อตให้บรรลุเป้าหมาย
Joker123 ยังคงเป็นเกมคาสิโนออนไลน์ที่พบบ่อยที่สุดและก็ชนิดนี้ยังคงเติบโตถัดไป เดี๋ยวนี้คือเรื่องธรรดาที่จะเจอสล็อตฟรีที่คาสิโนเสนอให้กับผู้ริเริ่มหรือสำหรับผู้เล่นที่กำลังมองหาวิธีฝึกฝนเล่นสล็อตความสามารถการเล่นเกมของตัวเอง ปัจจัยหนึ่งที่ทำให้สล็อตเป็นที่นิยมอย่างยิ่งเป็นความง่ายๆรวมทั้งจังหวะสำหรับในการชำระเงินที่สูง สล็อตยุคใหม่อาศัยแนวความคิดวงล้อและก็เส้นจ่าย นักปรับปรุงจำนวนมากเลือกใช้วงล้อมาตรฐาน 5 วงพร้อมช่องจ่าย 25 เส้น สล็อตแมชชีนที่มีเลย์เอาต์ดังที่ได้กล่าวผ่านมาแล้วให้ท่านได้ราวๆ 125 คอมโบที่คุณสามารถใช้เพื่อสร้างความมีชัยได้ แนวทางลักษณะนี้จะช่วยทำให้คุณอยู่ในเกมได้นานขึ้นนิดนึงซึ่งจะช่วยเพิ่มช่องทางสำหรับเพื่อการชนะ ถ้าคุณกำลังมองหาแนวทางกล้วยๆสำหรับเพื่อการเพิ่มจังหวะสำหรับในการชนะ Joker123 ที่มีช่องชำระเงินมากไม่น้อยเลยทีเดียวก็เหมาะสมมาก ดังเช่นว่าด้วยการพนัน 10 เหรียญใน 1 บรรทัดการจ่ายจาก 25 ที่มีอยู่คุณได้โอกาส 1:25 สำหรับการชนะ อย่างไรก็ดีเหรียญ 1 เหรียญใน 10 สายการจ่ายจะเพิ่มจังหวะของคุณเป็นสิบเท่า

Unknown said...

Very useful info! Thank you for the information!
Slots Online

Unknown said...

Your site has a lot of useful information for me, I visit it very often. Keep it up!
Poker 88

Unknown said...

Casino Option
Very useful info! Thank you for the information!

Unknown said...

Casinos Gaming
Very useful information and thank you for sharing!

Unknown said...

Casino Online
This post is very good! Thanks you for this information on the subject!

Unknown said...

Online Casino
I really enjoy playing Dewange Bet at home. Thank you for sharing this useful info!

yeardlypadalino said...

Casino (Chester City, OK) - Mapyro
Casino (Chester City, OK). 1. Casino, 1.3 km 충청남도 출장마사지 from 제주 출장샵 I-395, Exit 35. Closed. Closed. Gaming and Entertainment. 대전광역 출장마사지 Open since: 나주 출장샵 2017. Map 경산 출장마사지

Unknown said...

Play casino - No.1 for the Casino Guru
No longer have the opportunity to go worrione.com to the casinos goyangfc or read the reviews of ventureberg.com/ the slots you love. But they're sol.edu.kg not always the same. Sometimes you have a new online

packersandmoversinKondapur said...

Thanks you so much for your added suggestion.
packers and movers in kondapur

crystal101 said...

yeah, thanks for sharing.
go here
go here
go here
go here
go here
go here
go here
go here
go here
go here

Angel17 said...

Such an awesome post. Thanks for sharing this one! https://www.appliancerepair-kitchener.ca/frigidaire-repair-waterloo

Thomas Tracy said...

Infinispan implements the Spring SPI to offer high-performance, in-memory caching capabilities for Spring application more

Joana said...

Let's say in another part of the site, the user saves a puzzle. Unless I specifically notify the component that holds a peeling wallpaper session property to discard it, the number displayed in the sidebar will be wrong. Plus that notification introduces undesired coupling between two unrelated components.