Clear Nginx Cache with server side codes like Java or Groovy

Is it possible to clear or update Nginx cache data on some user interactions like CRUD operations with Java or Groovy?
I do have some set of APIs cached in Nginx which are served by a Grails(Java) server and the expiry is 10 minutes because the data is changing less often. However, I do have some set of areas where we need to clear those records whenever the user updates those entries in the server. Currently, the user needs to wait 10 minutes to reflect those changes in the other system and we are trying to clear the Cache programmatically when the user tries to update something.

Read more here: Source link