# Rails 2.3.2 server restart does not appear to clear fragment cache

**URL:** <https://www.ruby-forum.com/t/rails-2-3-2-server-restart-does-not-appear-to-clear-fragment-cache/164032>\
**Category:** Rails\
**Created:** [March 27, 2009, 2:56am UTC](https://www.ruby-forum.com/t/rails-2-3-2-server-restart-does-not-appear-to-clear-fragment-cache/164032 "2009-03-27T02:56:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sudhir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sudhir](https://www.ruby-forum.com/u/Sudhir)\
**Post date:** [March 27, 2009, 2:56am UTC](https://www.ruby-forum.com/t/rails-2-3-2-server-restart-does-not-appear-to-clear-fragment-cache/164032/1 "2009-03-27T02:56:40Z")

</div>

After upgrading to Rails 2.3.2 I am now experimenting with Rails  
caching. I have cache enabled for one action in a few controllers.  
This seems to work until I restart the server.

After restart, I get Invalid Authenticity token errors on POSTS from  
pages that were previously cached. I’ve tried clearing the browser  
cookies and cache and the problem does not appear to be on the browser  
side.

I think the default cache store is Memory. I don’t see any cached  
files on the disk.

I can clear the problem by visiting an uncached page on my application  
and POSTing from there. My cache sweeper expires the cache in that  
case. After this, everything works since I expire all cached URL’s.

Is there a way to definitely clear the Rails cache on server restart?

Also, please confirm that the default cache store is memory. I had  
assumed that the memory cache would clear automatically on server  
restart. Maybe my assumptions are not correct.

Thanks.

---

<div class="post-metadata">

**Author:** ![Sudhir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3ab097/32.png) [@Sudhir](https://www.ruby-forum.com/u/Sudhir)\
**Post date:** [March 27, 2009, 8:07am UTC](https://www.ruby-forum.com/t/rails-2-3-2-server-restart-does-not-appear-to-clear-fragment-cache/164032/2 "2009-03-27T08:07:19Z")

</div>

On Thu, Mar 26, 2009 at 6:55 PM, Sudhir [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I think the default cache store is Memory. I don’t see any cached  
> files on the disk.
> 
> I can clear the problem by visiting an uncached page on my application  
> and POSTing from there. My cache sweeper expires the cache in that  
> case. After this, everything works since I expire all cached URL’s.
> 
> Is there a way to definitely clear the Rails cache on server restart?

The following should work for you:

rake tmp:cache:clear

Thus, you might want to invoke the above when you start/restart

your server.

> Also, please confirm that the default cache store is memory. I had  
> assumed that the memory cache would clear automatically on server  
> restart. Maybe my assumptions are not correct.
> 
> Thanks.

In production, the default global cache is mem\_cache\_store.

Good luck,

-Conrad
