memoize can use a custom serializer