I have a similar issue, but not sure how to edit the redis functions since I'm using Spring Security:
Spring Boot / Spring Security App, geting AWS Redis Elasticache production error (failed: Connection reset by peer & CROSSSLOT error)