String may be unicode when read from the cache if json is used.

We should therefore store the string and not the datetime.datetime instance. And take care of unicode when reading back in.