Caching named queries is very useful, but there are cases when our system updates one row in a table and knows a specific result in the cache is no longer valid. Unfortunately, if we want users of the named query cache to get that new row sooner, then we need to flush the whole cache with "clearNamedQueryCache", which makes all other parameters to that named query to be lost, causing more traffic to hit the DB even though their cached values were still correct.
I would like if we had some method to force a refresh of one specific parameter set of the query cache. This could be done in one of two ways:
First way would be as a targeted clear, passing in an optional "parameters" value into clearNamedQueryCache that would match the "parameters" passed into runNamedQuery. This would remove that one result from the cache.
The second way would be as an optional force read-through on runNamedQuery, which would tell the named query to go directly to the DB for this one call, and update the cache with the results.