This project is archived and is in readonly mode.

#5121 ✓stale
siddick

[PATCH]URI decode problem in expire_fragement with regex

Reported by siddick | July 15th, 2010 @ 01:25 PM | in 3.x

I have a custom cache path for the Index action and Clear the cached actions using the expire_fragment with regular expression.

class BlogController < ApplicationController
  caches_action :index, :cache_path => Proc.new { "blog/#{params[:page]||1}" }
  def index
  end
  def expire_blog
   expire_fragment( /^blog/ )
   render :text => "success"
  end
end

When I access the expire_blog action, it Produce the following error message

 NoMethodError in BlogController#expire_blog
   undefined method ord' for nil:NilClass
</code>
</pre>


I used the FileStore to do the Caching.
I have attached the Patch, which will solve the URI decode and Regexp problem in expire_fragment

Comments and changes to this ticket

  • siddick

    siddick July 17th, 2010 @ 10:07 AM

    • Title changed from “URI decode problem in expire_fragement with regex ” to “[PATCH]URI decode problem in expire_fragement with regex ”
    • Tag changed from caches_action, expire_fragment, regexp to rails 3.0.0.beta4, caches_action, expire_fragment, file_store, regexp
  • siddick

    siddick July 24th, 2010 @ 04:43 AM

    • Tag changed from rails 3.0.0.beta4, caches_action, expire_fragment, file_store, regexp to rails 3.0.0.beta4, caches_action, expire_fragment, file_store, patch, regexp

    Any Updates on this bug..

  • Mage

    Mage September 17th, 2010 @ 09:41 PM

    This bug is still in Rails 3.0.0

    Since mem_cache_store doesn't support expire_fragment(Regexp) and memory_store is not shared between passenger apps, this bug prevents the deployment of my fragment cache based app.

    File_store would be perfect for my app needs without this bug.

  • Mage

    Mage September 21st, 2010 @ 05:12 PM

    • Assigned user set to “José Valim”
  • José Valim

    José Valim September 24th, 2010 @ 11:31 AM

    • Milestone set to 3.x
    • State changed from “new” to “open”
    • Importance changed from “” to “Low”

    Patch needs some documentation. Please update the expire_fragment docs, mentioning that you can pass a regexp and which stores allows a regexp to be given.

  • Mage

    Mage September 28th, 2010 @ 09:17 PM

    I don't really have much documentation.

    The Agile Rails Development book (4th edition) which is quite official says on Page 405:

    "The expire_fragment method can also take a single regular expression as a parameter, allowing us to expire all fragments whose names match:
    expire_fragment(%r{/blog2/list.*})"

    The facts are:

    • memory_store accepts expire_fragment regexp. It works fine.
    • mem_cached_store doesn't accept it. It says method missing for delete_matched.
    • file_store accepts it but has this bug.

    More docs:

    http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
    http://api.rubyonrails.org/classes/ActiveSupport/Cache/FileStore.html
    http://api.rubyonrails.org/classes/ActiveSupport/Cache/MemCacheStor...

  • siddick
  • Mage

    Mage September 29th, 2010 @ 01:48 PM

    Nice.

    I am not too familiar with Memcached, I was just wondering if it's possible to implement expire_fragment(Regexp) for memcached too by storing the fragment names in a mem_cached Array.

    Same way as memory_store does that.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • Tag changed from rails 3.0.0.beta4, caches_action, expire_fragment, file_store, patch, regexp to rails 300beta4, caches_action, expire_fragment, file_store, patch, regexp

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages