# Expires\_in with fragment-caching

**URL:** <https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527>\
**Category:** Rails\
**Created:** [December 29, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527 "2008-12-29T15:19:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [December 29, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527/1 "2008-12-29T15:19:18Z")

</div>

Hi all

Is it posible do have a expires\_in with fragment-caching? Does this  
work with memcached?

Thank you for your aswers!

Chris

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [December 29, 2008, 4:47pm UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527/2 "2008-12-29T16:47:55Z")

</div>

Chris,

1. If you are running rails 2.1 && memcached then you can do this in  
fragment caching:

\<% cache(key, :expires\_in =\> 5.minutes) do %\>  
hello, world!  
\<% end %\>

- Gautam

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [December 29, 2008, 4:47pm UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527/3 "2008-12-29T16:47:55Z")

</div>

If you are using rails 2.1 && memcached, then you can do this :

\<% cache(key, :expires\_in =\> 5.minutes) do %\>  
hello, world  
\<% end %\>

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [March 9, 2009, 10:09am UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527/4 "2009-03-09T10:09:53Z")

</div>

Jeffrey L. Taylor wrote:

> Quoting sigma [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > Hi all
> > 
> > Is it posible do have a expires\_in with fragment-caching? Does this  
> > work with memcached?
> 
> Yes, though memcached is the only mechanism it is already built-in.  
> There is  
> a way that works with the other three mechanisms (I think, I’ve only  
> tried it  
> with memory\_store). If anyone is interested, I’ll post it on my blog.
> 
> Jeffrey

hi,I’m interesting.where your blog

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [December 29, 2008, 10:11pm UTC](https://www.ruby-forum.com/t/expires-in-with-fragment-caching/156527/5 "2008-12-29T22:11:16Z")

</div>

Quoting sigma [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hi all
> 
> Is it posible do have a expires\_in with fragment-caching? Does this  
> work with memcached?

Yes, though memcached is the only mechanism it is already built-in.  
There is  
a way that works with the other three mechanisms (I think, I’ve only  
tried it  
with memory\_store). If anyone is interested, I’ll post it on my blog.

Jeffrey
