def lookup(object, key, opts, &block)
      if !block.nil?
        define(object, key, opts, &block)
      elsif key =~ /(.*)_count$/
        if AridCache.store.has?(object, $1)
          method_for_cached(object, $1, :fetch_count, key)
        elsif object.respond_to?(key)
          define(object, key, opts, :fetch_count)
        elsif object.respond_to?($1)
          define(object, $1, opts, :fetch_count, key)
        else
          raise ArgumentError.new("#{object} doesn't respond to #{key.inspect} or #{$1.inspect}.  Cannot dynamically create query to get the count, please call with a block.")
        end
      elsif AridCache.store.has?(object, key)
        method_for_cached(object, key, :fetch)
      elsif object.respond_to?(key)
        define(object, key, opts, &block)
      else
        raise ArgumentError.new("#{object} doesn't respond to #{key.inspect}!  Cannot dynamically create query, please call with a block.")
      end
      object.send("cached_#{key}", opts)
    end
def lookup(object, key, opts, &block)
      if !block.nil?
        define(object, key, opts, &block)
      elsif key =~ /(.*)_count$/
        if AridCache.store.has?(object, $1)
          method_for_cached(object, $1, :fetch_count, key)
        elsif object.respond_to?(key)
          define(object, key, opts, :fetch_count)
        elsif object.respond_to?($1)
          define(object, $1, opts, :fetch_count, key)
        else
          raise ArgumentError.new("#{object} doesn't respond to #{key.inspect} or #{$1.inspect}.  Cannot dynamically create query to get the count, please call with a block.")
        end
      elsif AridCache.store.has?(object, key)
        method_for_cached(object, key, :fetch)
      elsif object.respond_to?(key)
        define(object, key, opts, &block)
      else
        raise ArgumentError.new("#{object} doesn't respond to #{key.inspect}!  Cannot dynamically create query, please call with a block.")
      end
      object.send("cached_#{key}", opts)
    end
Lookup something from the cache.

 If no block is provided, create one dynamically.  If a block is
 provided, it is only used the first time it is encountered.
 This allows you to dynamically define your caches while still
 returning the results of your query.

 @return a WillPaginate::Collection if the options include :page,
  a Fixnum count if the request is for a count or the results of
  the ActiveRecord query otherwise.