# Rails asset cache

**URL:** <https://www.ruby-forum.com/t/rails-asset-cache/192080>\
**Category:** Rails\
**Created:** [July 23, 2010, 11:52am UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080 "2010-07-23T11:52:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 23, 2010, 11:52am UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/1 "2010-07-23T11:52:50Z")

</div>

I have a of line code like  
\<%= stylesheet\_link\_tag “styles”,:cache =\> “cache/styles” %\>

```
And it produces source as

```

```
config.action_controller.perform_caching = true

```

My concern is what is 1279620123 after question mark(?) above. If such a  
random number always appended, whether caching in browser happens or  
not?Please give me a good idea

Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 23, 2010, 12:21pm UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/2 "2010-07-23T12:21:18Z")

</div>

On 23 July 2010 10:52, Tom M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My concern is what is 1279620123 after question mark(?) above. If such a  
> random number always appended, whether caching in browser happens or  
> not?Please give me a good idea

It’s the timestamp when the file was last changed (or the last file if  
you  
list multiple stylesheets in stylesheet\_link\_tag).

That way browsers can cache it long term and it will automatically  
change if  
you change one of the files during a new deployment.

Cheers,

Andy

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 26, 2010, 7:42am UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/3 "2010-07-26T07:42:58Z")

</div>

Hi  
Again I am facing a problem. I am using firefox with firebug.A  
portion of my code like  
\<%= stylesheet\_link\_tag “styles”,“home”, :cache =\> “cache/all” %\>

Now in my local machine from firebug under net tab I disabled “Browser  
cache” .Then result I got like

GET home [http://localhost:3000/home](http://localhost:3000/home) 200 OK localhost:3000 14.4 KB (?)  
…  
GET styles.css?1279620123  
[http://localhost:3000/stylesheets/styles.css?1279620123](http://localhost:3000/stylesheets/styles.css?1279620123)  
200 OK …

Again from local machine I enabled “Browser cache” and got result  
like(Only the below line I got)  
GET home [http://localhost:3000/home](http://localhost:3000/home) 304 Not Modified localhost:3000 14.4  
KB …

But the above same procedure when I did from another machine which is  
not local, I got the same result for both the steps. Caching did not  
happen.

```
I got 200 OK for both steps. I am running in staging mode. Please 

```

help me to resolve this

Thanks  
Tom

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 27, 2010, 12:49pm UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/4 "2010-07-27T12:49:48Z")

</div>

Sorry, no idea.

(just to let you know that you’re not being ignored it’s just likely  
that  
no-one has an answer for you, this generally works fine for me).

–  
Andy J.  
[http://andyjeffries.co.uk/](http://andyjeffries.co.uk/)#rubyonrails #mysql #jquery  
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS  
Company number: 5452840

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 27, 2010, 6:35pm UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/5 "2010-07-27T18:35:13Z")

</div>

I development mode, cache is disabled.

---

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [July 27, 2010, 6:49am UTC](https://www.ruby-forum.com/t/rails-asset-cache/192080/6 "2010-07-27T06:49:53Z")

</div>

Hi  
Could anybody please clarify my doubt?

Thanks
