There are some tricks related to the cache key option.
Keep in mind that a Serializer represents one single object, and it call itself recursively when parsing an array of objects. (as on an index method return)
There is two ways to cache it:
1. Cache the entire serializer return for each method that uses it
2. Cache every major object that is in it, individually (it may be one or more, as in case of an array of objects)
Both are valid strategies, but the second one seems the best, because it allows AMS to re-use the cached object in different returns, and if a cached object is destroyed it doesn't destroy others that still valid.
There are definitively some hidden tradeoffs in there, but it seems the best way to go.
In order to implement it I'm going to need more then one cache key, so, I'd like to define a pattern related to the cache key
Take the example bellow:
class PostSerializer < ActiveModel::Serializer
cache key: 'great-post', expires_in: 3.days