# Doable ? action caching if anonymous, fragment caching if lo

**URL:** <https://www.ruby-forum.com/t/doable-action-caching-if-anonymous-fragment-caching-if-lo/89790>\
**Category:** Rails\
**Created:** [March 22, 2007, 7:03pm UTC](https://www.ruby-forum.com/t/doable-action-caching-if-anonymous-fragment-caching-if-lo/89790 "2007-03-22T19:03:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aravet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@aravet](https://www.ruby-forum.com/u/aravet)\
**Post date:** [March 22, 2007, 7:03pm UTC](https://www.ruby-forum.com/t/doable-action-caching-if-anonymous-fragment-caching-if-lo/89790/1 "2007-03-22T19:03:38Z")

</div>

Hi All,

I’d like to use different caching strategies based on the visitor status

- anonymous =\> action caching
- logged in =\> fragment caching

Is that doable? Where should I start?

TIA

Alain

---

<div class="post-metadata">

**Author:** ![aravet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/49beb7/32.png) [@aravet](https://www.ruby-forum.com/u/aravet)\
**Post date:** [March 23, 2007, 10:21pm UTC](https://www.ruby-forum.com/t/doable-action-caching-if-anonymous-fragment-caching-if-lo/89790/2 "2007-03-23T22:21:21Z")

</div>

SOLVED

The action\_cache plugin  
[http://agilewebdevelopment.com/plugins/action\_cache](http://agilewebdevelopment.com/plugins/action_cache)

adds a methods that enables conditional action caching :

class ApplicationController \< ActionController::Base  
…

```
   def cache_action?(action_name)
     !admin?
   end
 ...
end

```
