def encode_to_hash(resource, *args)
      if id = get_resource_identifier(resource)
        cache_key = "#{resource.class.name}:#{id}"
        cache[cache_key] ||= _encode_to_hash(resource, *args)
      else
        _encode_to_hash(resource, *args)
      end
    end
def encode_to_hash(resource, *args)
      if id = get_resource_identifier(resource)
        cache_key = "#{resource.class.name}:#{id}"
        cache[cache_key] ||= _encode_to_hash(resource, *args)
      else
        _encode_to_hash(resource, *args)
      end
    end
Cache resource encoding result if the resource can be identified.
 Garage try to get resource identifier by acccess the resource
 `#resource_identifier` or `#id`.