Save attribute to cache, but not to persist DB

Hello everyone!
We have a very specific project based on keycloak and when we use our SPI with a lot of setAttribute methods on UserModel our connection pool to Postgres overflows and our app is crashing.
So we decide use another app to save data to Postges and SPI to save data to keycloak cache. But we have a problem to save atrribute to cache, because keycloakSession have transaction, which save data to DB (as we think)
Did anyone do something like that?
Thanks in advance