You would need to write some external code that will be able to listen to changes in the DB and flush (portions of) the cache accordingly.
Thanks!!!, it will be great if you can share a sample code with me.
No, I can't.
1) I have no idea what your app is about or how it works
2) I don't want to take all the fun away from you!!
Write a thread or something to poll the db and check for updates. You may need a versioning field or a tstamp. Alterlatively, have the app that DOES change the DB somehow inform your app. Perhaps via a messaging system. Then have your app remove appropriate portions from the cache.