# Preventing caching of specific snippets

**URL:** <https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406>\
**Category:** Radiant CMS\
**Created:** [July 3, 2007, 7:05am UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406 "2007-07-03T07:05:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyril\_Ucron\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/43a26b/32.png) [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Post date:** [July 3, 2007, 7:05am UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406/1 "2007-07-03T07:05:06Z")

</div>

Hi,

is there a way to prevent a snippet from being cached, but caching  
everything else?

Thanks,  
Cyx

---

<div class="post-metadata">

**Author:** ![Cyril\_Ucron\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/43a26b/32.png) [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Post date:** [July 3, 2007, 10:10am UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406/2 "2007-07-03T10:10:32Z")

</div>

AFAIK Radiant caches full rendered pages, no snippets.

```
/AITOR
```

---

<div class="post-metadata">

**Author:** ![Cyril\_Ucron\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/43a26b/32.png) [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Post date:** [July 3, 2007, 5:52pm UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406/3 "2007-07-03T17:52:53Z")

</div>

That’s correct, and whenever you change a snippet, the whole page  
cache should be cleared.

Sean

---

<div class="post-metadata">

**Author:** ![Cyril\_Ucron\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/43a26b/32.png) [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Post date:** [July 4, 2007, 1:45am UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406/4 "2007-07-04T01:45:52Z")

</div>

ahh,

well the scenario is a have a snippet that renders a randomized banner  
for  
the site. if course if you cache the page, the randomization won’t  
happen.  
do you guys know of a way around this?

right now my only solution has been to turn off caching all in all. i  
hope  
there’s a better way to do this.

Thanks,  
Cyx

---

<div class="post-metadata">

**Author:** ![Cyril\_Ucron\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/43a26b/32.png) [@Cyril\_Ucron\_D](https://www.ruby-forum.com/u/Cyril_Ucron_D)\
**Post date:** [July 4, 2007, 3:55am UTC](https://www.ruby-forum.com/t/preventing-caching-of-specific-snippets/108406/5 "2007-07-04T03:55:00Z")

</div>

You could do the randomization in Javascript, perhaps. Here’s a basic  
outline:

Sean
