Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Assets mapping of URL to filename is cached between Capistrano releases #2397

andyjeffries opened this Issue · 4 comments

3 participants


We have an application that is deployed frequently by our CI environment. The other day (having upgraded to 3.1.0 RC5) I noticed that it was breaking in serving images.

The reason seems to be that somewhere there is a mapping that converts URLs like "/assets/logo.png" (generated by asset-url() in SCSS files) to /some/where/project/releases/201108021104/public/assets/logo-19ae....png.

The problem is that this cache is around long after that folder has been cleaned out by Capistrano only keeping the last 5 deployments.

It seems to be in Memcached (as a restarted of Memcached fixes it), but we don't want our clients to have to wipe out Memcached after a new deployment. For this reason in our code we prefix a cache_namespace value to the start of all cache keys, so we can change that value for a single application and not have to wipe out the whole of Memcached.

Is it possible to do this for Rails 3.1's asset pipeline? This might just be a documentation issue - there may be an easy way to do it, but it's not obviously documented (to me).

I saw in Sprockets::Digest the comment:

"The Environment#version is a custom value used for manually expiring all asset caches."

But I can't see a way to set this as Rails.application.assets only returns a Sprockets::Index (immutable Sprockets::Environment).

I also noticed there is a private method "cache_key_namespace" on Sprockets::Caching, but that when I request a static asset with Memcached in -vv mode, it doesn't actually seem to have that cache_key_namespace value at the start anyway.




@andyjeffries Is this still an issue?


Hasn't been an issue for a while for me now. You can close this ticket as far as I'm concerned (or I'll close it if it needs to be the opener).

@arunagw arunagw closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.