]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
Strings returned by get_cached now have a cached? method which returns true or false...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 25 Oct 2006 19:37:00 +0000 (19:37 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 25 Oct 2006 19:37:00 +0000 (19:37 +0000)
ChangeLog
lib/rbot/httputil.rb

index 9c9e71201f8baa11696b6c157084c6f08d0a3c95..203bd3c7771d199467b77e6c24c455569b436ef2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-25  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
+
+       * HttpUtil: Strings returned by get_cached now have a cached? method
+       which returns true or false depending on whether the result was taken
+       from the cache or not; this can be exploited by plugins that parse the
+       result in some particular way, since they can now skip the parsing
+       stage if they cache the parse result.
+
 2006-10-24  Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
 
        * HttpUtil: initial implementation of proper caching based on
index 3f2da1a53b7d5c87b7ac4c171d1fa6cac36c249e..c1c8f4c107c83b6e2bedb6f966045775d375a9fc 100644 (file)
@@ -354,12 +354,14 @@ class HttpUtil
     if expired?(uri, readtimeout, opentimeout)
       debug "Cache expired"
       bod = get(uri, readtimeout, opentimeout, max_redir, [noexpire])
+      def bod.cached?; false; end
     else
       k = uri.to_s
       debug "Using cache"
       @cache[k][:count] += 1
       @cache[k][:last_use] = Time.now
       bod = @cache[k][:body]
+      def bod.cached?; true; end
     end
     unless noexpire
       remove_stale_cache