May I set data to data store 2 when player removing?

I have some info in my own cache, so when player leave this cache should be set to data store 2,
P.S: I can’t save this cache earlier then player leave