# Flash not deleting with Redis/Memcache store

**URL:** <https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420>\
**Category:** Rails\
**Created:** [May 31, 2010, 5:44pm UTC](https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420 "2010-05-31T17:44:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Brisbin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@Jon\_Brisbin](https://www.ruby-forum.com/u/Jon_Brisbin)\
**Post date:** [May 31, 2010, 5:44pm UTC](https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420/1 "2010-05-31T17:44:57Z")

</div>

I’m a recent convert to Rails and I’m working on a new project using  
Rails 2.3 (I’ll probably upgrade at some point when Rails 3 is in  
production and had a chance to bake the .0 bugs out). I’m going to use  
Redis anyway for caching important data, so I thought I’d use the  
redis-store:

> **[GitHub - redis-store/redis-store: Namespaced Rack::Session, Rack::Cache, I18n...](https://github.com/redis-store/redis-store)**
>
> Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks - GitHub - redis-store/redis-store: Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for...

But it appears the flash messages aren’t going away when they’re  
supposed to as discussed in this issue, which I haven’t gotten a  
response on yet:

> **[Issues · redis-store/redis-store](https://github.com/redis-store/redis-store/issues#issue/3)**
>
> Namespaced Rack::Session, Rack::Cache, I18n and cache Redis stores for Ruby web frameworks - Issues · redis-store/redis-store

The gist is ActionController::Flash::FlashHash#sweep isn’t properly  
detecting that a flash has been used when using either the Memcache or  
Redis store for sessions.

So how do I delete them manually? I thought about just editing the  
FlashHash class and forcing it to delete any flash keys without checking  
the @used stuff. That would for sure delete the key, but I don’t know  
enough about Rails internals to say whether that will have unintended  
side effects.

Any advice on what I need to do here?

Thanks!

J. Brisbin

> **[jon brisbin | home](http://blog.jbrisbin.com/)**
>
> This is a starter/theme for GatsbyJS

---

<div class="post-metadata">

**Author:** ![Jon\_Brisbin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f14d63/32.png) [@Jon\_Brisbin](https://www.ruby-forum.com/u/Jon_Brisbin)\
**Post date:** [June 6, 2010, 8:02pm UTC](https://www.ruby-forum.com/t/flash-not-deleting-with-redis-memcache-store/189420/2 "2010-06-06T20:02:59Z")

</div>

Hi,  
I’ve fixed this issue in 0.3.8 by replacing the old implementation,  
borrowed from rack.  
Just config the gem:

# config/environment.rb

config.gem “redis-store”

then configure as session store:

# config/initializers/session\_store.rb

ActionController::Base.session\_store = :redis\_session\_store

Luca
