implement cache via DeviceCache template