def database_cached_attribute(*attrs)
      attrs.each do |attr|
        define_method("invalidate_#{attr}") do |arg=nil| # default arg to allow before_blah callbacks
          invalidate_cache attr.to_sym
        end

        define_method("only_#{attr}_changed?") do 
          only_change? attr.to_sym
        end

        define_method("cache_#{attr}") do
          update_cache attr.to_sym
        end
      end
    end
def database_cached_attribute(*attrs)
      attrs.each do |attr|
        define_method("invalidate_#{attr}") do |arg=nil| # default arg to allow before_blah callbacks
          invalidate_cache attr.to_sym
        end

        define_method("only_#{attr}_changed?") do 
          only_change? attr.to_sym
        end

        define_method("cache_#{attr}") do
          update_cache attr.to_sym
        end
      end
    end
Sets up cache invalidation callbacks for the provided attributes