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.

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

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


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

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

SEO Service Noida said...

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

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


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

nilila said...


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

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

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

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 경산 출장마사지

Anonymous 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

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

Guest said...

I guess this is a nice content post, thanks for this! Roofing Services

Harry Kane said...

I really appreciate the effort you put into this. It's evident that you did thorough research.
drain pipe installation worcester ma

Abhishek Jaswal said...

Agarwal Packers and Movers are the Best Packers and Movers in Moshi Pune.

Guest said...

That’s a great post thanks admin, https://www.drywallservicesvictoria.com/

Guest said...

Your content always stands out. It's informative and enjoyable to read. Drywall Contractor in Richmond

Kyzer said...

Glad to check this site. Great work! pool motor pump repair

Unknown said...

By combining session-scoped properties in Tapestry with the flexibility of Spring modules caching and utilizing the HTTP session for caching data, you've created a solution that effectively handles the challenges associated with user-specific data caching in a web application. blog




Nathalie said...

Glad to visit this one, gonna share it with my friends. click

Guest said...

Thank you for sharing such valuable information. It's definitely going to assist me in my work. Expert Repair Crew in Concrete

Kerstin said...

It's nice to hear an updated post here. Thanks for sharing. Memphis Artificial Grass Experts synthetic turf

Brett said...

Awesome post! Looking forward to seeing more information post here. Dirt Work

Kyzer said...

Thank you for the great information you shared. Southaven Masonry brick repair

Anna said...

Nice post! Looking forward to seeing more contents here. epoxy shed floor

john said...

Thanks for the great post! drywall company

RyeD said...

It's very informative content you shared. New York full-site development

Angel17 said...

Your post is so informative. It is so useful to your readers. cash for junk cars cambridge

Angel17 said...

I like your post. It is so informative! cash for junk cars cambridge

Zabel said...

Thanks for the time you took to share this info here. Germantown Paint Company

Anna said...

This is awesome! Would love to see more posts here. pool screen repair

Kerstin said...

It's nice seeing this great information on this site. Looking forward to more posts. anti aging treatments

Janwil said...

Interesting post! Glad to check this content here. Collierville Roof Pros Roofing Company

Joana said...

Let's say in another part of the site, the user saves a puzzle. Unless I specifically notify the component that holds the session of SgtShadow to discard it, the number displayed in the side bar will be wrong.

RyeD said...

Thanks for sharing your thoughts here, really appreciated. East Texas Concreters concrete slab

Brett said...

Glad to see this great site again. Roofer

Shawn said...

This is a great shared blog! pool enclosure

Kyzer said...
This comment has been removed by the author.
Kyzer said...

It's good to see this site again for a long time now. Thanks for keeping us posted here. demolition company

Joana said...

Hello! I need a website right now. Can someone help me?

Kerstin said...

Thank you for taking the time to share this post. excavation company

Ethan said...

Your solution demonstrates an elegant blend of Spring's caching capabilities and session-scoped data management to address a nuanced challenge: maintaining user-specific caching while avoiding staleness and resource competition. https://purewaterpoolsofnaples.com

Anna said...

It's a great site to visit. Thanks for this blog you shared. Elite Roofing Sacramento Roof Repair

KellyP said...

Consider the specific implementation details of your application and the database system you're using to determine the most suitable optimization techniques.


roofing jobs in Cincinnati Ohio

Brett said...

Thank you for the information you shared here. Retaining wall builders

KellyP said...

That's a common performance bottleneck in web applications.

rolex dealer cincinnati