silverstripe / silverstripe-graphql

Serves Silverstripe data as GraphQL representations
BSD 3-Clause "New" or "Revised" License
52 stars 61 forks source link

Bust query cache for last-deleted (or a combination of last deleted and last edited, i.e. last modified) for versioned records #554

Open sabina-talipova opened 10 months ago

sabina-talipova commented 10 months ago

Description

Currently the QueryCachingMiddleware buses cache based on the LastEdited date - but if the query includes versioned records, and something was deleted after the LastEdited date, we should probably bust the cache for that too.

QueryCachingMiddleware::getCachedResponse() could be improved to get last-deleted/modified as well for versioned records. See https://github.com/silverstripe/silverstripe-graphql/blob/7684d1592f65d85816c2eb0d94f11414771b7081/src/Middleware/QueryCachingMiddleware.php#L115

Notes