search for: cachedwebpage

Displaying 1 result from an estimated 1 matches for "cachedwebpage".

2012 Jul 23
2
Mechanize::Agent#post_connect_hook response != Mechanize#parse response
...er. I want to store the un-parsed (raw) page in the db, and call Mechanize#parse when there''s a cache hit, something along these lines: class CachingMechanize < Mechanize def initialize super self.agent.post_connect_hooks << lambda {|agent, uri, response, body| CachedWebPage.create!(:uri => uri.to_s, :response => response :contents => body) } end def get(uri, parameters = [], referer = nil, headers = {}) page = if (cached = CachedWebPage.find_by_uri(uri.to_s)) # cache hit...