# Caching question

**URL:** <https://www.ruby-forum.com/t/caching-question/168111>\
**Category:** Rails\
**Created:** [May 16, 2009, 1:22am UTC](https://www.ruby-forum.com/t/caching-question/168111 "2009-05-16T01:22:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/839c29/32.png) [@pedz](https://www.ruby-forum.com/u/pedz)\
**Post date:** [May 16, 2009, 1:22am UTC](https://www.ruby-forum.com/t/caching-question/168111/1 "2009-05-16T01:22:01Z")

</div>

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
