Deleting query plan cache

Hi, guys one of my service where i working at got OOM and the cause is there are so many query plan cache was thinking to remake the query but then again we gonna migrate it to go soon, as quick fix i am wondering is it possible to do a cron where it is possible to delete the query plan ache every 1 hour or so?

The correct way to prevent the query plan cache from becoming too big is using the hibernate.query.plan_cache_max_size setting. This configuration property allows you to specify a maximum number of entries that will be kept in the cache, and will progressively be substituted by new query plans.

Note that the default value is 2048.