# :expires\_in not working with memcache/fragment caching?

**URL:** <https://www.ruby-forum.com/t/expires-in-not-working-with-memcache-fragment-caching/172743>\
**Category:** Rails\
**Created:** [July 27, 2009, 11:39am UTC](https://www.ruby-forum.com/t/expires-in-not-working-with-memcache-fragment-caching/172743 "2009-07-27T11:39:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjoerd\_Tieleman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Sjoerd\_Tieleman](https://www.ruby-forum.com/u/Sjoerd_Tieleman)\
**Post date:** [July 27, 2009, 11:39am UTC](https://www.ruby-forum.com/t/expires-in-not-working-with-memcache-fragment-caching/172743/1 "2009-07-27T11:39:51Z")

</div>

Hi all,

I’m using memcache (which support the :expires\_in option) and I’m  
using it in a view to cache a certain piece of HTML, somewhat like:

\<% cache :expires\_in =\> 10.minutes %\>  
some HTML  
\<% end %\>

Funny thing is that I can see in memcache that the key is being set:

set views/localhost:3000/gids?expires\_in=600 0 0 6619

However, as you can see the :expires\_in is being passed as part of the  
key and not as the expiration flag in memcache (the second 0 should be  
600).

Is there anything I’m doing wrong here?

Kind regards,

Sjoerd Tieleman.

---

<div class="post-metadata">

**Author:** ![Sjoerd\_Tieleman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/71e660/32.png) [@Sjoerd\_Tieleman](https://www.ruby-forum.com/u/Sjoerd_Tieleman)\
**Post date:** [July 27, 2009, 11:55am UTC](https://www.ruby-forum.com/t/expires-in-not-working-with-memcache-fragment-caching/172743/2 "2009-07-27T11:55:40Z")

</div>

Well, I’ve solved my own problem. You need to explicitly specify a key  
before you can supply any options. Otherwise the options will be added  
to the key.

Kind regards,  
Sjoerd.
