Caching question

I have a strange set up where my Rails app is essentially a front end for a legacy system. When I request comes in, the Rails application asks the legacy system "is the data I have cached up to date?" If it is not, then I fetch a fresh copy and in that case, I would have to redraw the page.

But in the case that my cache is up to date and I already have page or an action or a fragment cached, I'd like to use what has been cached.

So, would it work to use action or fragment caching, and if I update the database during the early part of the request, I delete the action or fragment that has been cached and continue on; otherwise I do not do the delete and if it has been cached, it will work normally?

Thanks, pedz