Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH]URI decode problem in expire_fragement with regex

#5121

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

Reported by siddick · July 15th, 2010 @ 01:25 PM

State: stale
Milestone: 3.x
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. siddick
    siddick
    • 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

    July 17th, 2010 @ 10:07 AM

  2. siddick
    siddick
    • 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..

    July 24th, 2010 @ 04:43 AM

  3. Mage
    Mage

    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.

    September 17th, 2010 @ 09:41 PM

  4. Mage
    Mage
    • Assigned user set to José Valim

    September 21st, 2010 @ 05:12 PM

  5. José Valim
    José Valim
    • 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.

    September 24th, 2010 @ 11:31 AM

  6. Mage
    Mage

    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...

    September 28th, 2010 @ 09:17 PM

  7. siddick
  8. Mage
    Mage

    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.

    September 29th, 2010 @ 01:48 PM

  9. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 2nd, 2011 @ 04:59 PM

  10. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:59 PM