Checking if cache is not null in createAll() method