# Caching js

**URL:** <https://www.ruby-forum.com/t/caching-js/133993>\
**Category:** Rails\
**Created:** [April 6, 2008, 9:42am UTC](https://www.ruby-forum.com/t/caching-js/133993 "2008-04-06T09:42:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keynan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8dc957/32.png) [@keynan](https://www.ruby-forum.com/u/keynan)\
**Post date:** [April 6, 2008, 9:42am UTC](https://www.ruby-forum.com/t/caching-js/133993/1 "2008-04-06T09:42:19Z")

</div>

Hi all,

I want to cache the results of a rjs file as a fragment.  
Any one know how?

-K

---

<div class="post-metadata">

**Author:** ![keynan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8dc957/32.png) [@keynan](https://www.ruby-forum.com/u/keynan)\
**Post date:** [April 12, 2008, 11:33pm UTC](https://www.ruby-forum.com/t/caching-js/133993/2 "2008-04-12T23:33:58Z")

</div>

Keynan P. wrote:

> …

Of course, you can put:

cache do  
#…  
end

around the call to render the rjs.

If the rjs template is called implicitly, you can just make it explicit:

cache do  
render :rjs #or whatever you call to render the template  
end

Hope that’s helpful
