AMS and conditional gets - any way to detect when serializers change?

35 views
Skip to first unread message

Gordon McNaughton

unread,
Nov 21, 2013, 6:51:28 AM11/21/13
to rails-a...@googlegroups.com
Hi guys!

I have an AMS caching question: I'm trying to speed up a json API using http conditional gets.  The problem is, when I change an AMS serializer (for instance, to add an attribute), the server doesn't know and tells the browser that its cache is fresh.

  def show
    @product = Product.find(params[:id])
   
if stale?(@product) # oops! not if ProductSerializer changed
      render json: @product
    end
  end


Is there any analog to cache_digests, to detect when an AMS serializer changes and mix that into the etag/cache key?  Or should I include a build version/timestamp in the etag for every ApiController stale? call?

Any advice appreciated!
-Gordon
Reply all
Reply to author
Forward
0 new messages