Solved

invalidate cache entries in Dynacache based on database entry

Posted on 2006-06-27
6
1,836 Views
Last Modified: 2013-12-10
Hi experts

We are looking in to using websphere dynacache to cache a data structure that we build from the results of a db query. The data base tables are updated about every 5 minutes or so and we want to rerun the query and re-cache the data at about the same time the db is updated.  A small table exists that stores the timestamp of the last time an update was made.  What options are available to invalidate the cached data using this configuration?

 We were thinking we could poll that table every 30 seconds or so and see if the time stamp has changed since the last time the data was cached.  But I have not used dynacache before and from what I've read so far I don't know how to make it work the way we would like it to.  Any suggestions?

Thanks
Dave
0
Comment
Question by:NHBFighter
  • 2
6 Comments
 
LVL 4

Author Comment

by:NHBFighter
ID: 16994344
An additional requirment is that we cannot spawn any threads in out code. All threads should be managed by websphere.
0
 
LVL 3

Expert Comment

by:yuseungkim
ID: 16995517
So you need to configure Cache Invalidation with your code.

You can check "WebSphere Application Server V6 Scalability and Performance Handbook" from http://www.redbooks.ibm.com

Following is

The dynamic cache service provides event-based and time-based invalidation
techniques. WebSphere Application Server V6 offers access to programmatic
cache and invalidation techniques. Invalidation policies can be defined with XML
cache policy files. Invalidation policies allow triggering events to invalidate cache
entries without the need to write explicit code. More complex invalidation
scenarios may require code, which invokes the invalidation API.
Below Example shows the invalidation policy, which invalidates cache entries for
groups of objects using the same Account_UserID dependency ID. For example,
home servlet and all commands invoked by home servlet are invalidated when
the user logs out from the application.

Following Example show Invalidation policy defined in the logout command in cachespec.xml file
( please refer to the WebSphere InfoCenter for more detailed information about the cachespec.xml file. )

<cache-entry>
<class>command</class>
<sharing-policy>not-shared</sharing-policy>
<name>com.ibm.websphere.samples.trade.command.LogoutCommand</name>
<invalidation>Account_UserID
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
<invalidation>Holdings_UserID1
<component id="getUserID" type="method">
<required>true</required>
</component>
</invalidation>
</cache-entry>

Cheers

Andy
0
 
LVL 4

Author Comment

by:NHBFighter
ID: 16995646
I think I understand that but for these to work something has to be triggered correct. IE a method in the command has to be called. What I need is to have something wake up every 30 seconds or so, see if the cache should be invalidated and then trigger the mehtod to invalidate the cache.

The idea we are working on now is to have two things in cache one is the data we want to cache and the other is a dummy object. The dummy object will be put into the cache and its TTL will be set to 30 seconds. Then we will put a listner on the experiation of that dummy object. When the listener is triggered the data base can be polled to see if the cache has expired. If so the update to the data we want to cache can be made. This process of the dummy object expiring every 30 seconds will be repeated indefinetly.

How does that idea sound?

Thanks
Dave
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17668213
PAQed with points refunded (300)

DarthMod
Community Support Moderator
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weblogic server  backup 5 111
using multiple database in adf application 15 221
Usiing_selfsigned_ssl_certificate 5 112
listing all functions in JavaScript 19 216
Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question