def cache_wrap(action)
cache = Innate::Cache.action
ancestral_trait[:cache_action].each do |cache_action|
temp = cache_action.dup
block = temp.delete(:key)
ttl = temp.delete(:ttl)
if temp.all?{|key, value| action[key] == value }
cache_key = action.full_path
cache_key << "_#{action.instance.instance_eval(&block).to_s}" if block
if cached = cache[cache_key]
action.options[:content_type] = cached[:type]
else
cached = {
:body => catch(:respond) { yield },
:type => response['Content-Type']
}
if ttl
cache.store(cache_key, cached, :ttl => ttl)
else
cache.store(cache_key, cached)
end
end
return cached[:body]
end
end
yield
end