Update Generator.php

No need to serialize by your own. The cache provider decides if serialization is the correct way to store the data.

Doctrine Cache-Interface: 
@param mixed  $data     The cache entry/data.