Fix problem with restoring containers from the cache

When restoring the container from the cache, unpickling failed
because of trying to construct set() of objects which were not
fully rebuild yet (__hash__ failed because of missing self._id).

So we need to convert containers into list of ids before the
cache dump and instantiate the objects back after cache restore.
In addition, expiration setup moved to a separate method setup()