added lifetime option to cache layer