File tree Expand file tree Collapse file tree 2 files changed +4
-26
lines changed
Expand file tree Collapse file tree 2 files changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -237,10 +237,6 @@ func (c *cacheConn) execUpdate(ctx context.Context, queryInfo domains.CachePlanQ
237237 }
238238 if ! updateByUnique {
239239 for _ , cache := range cacheByTable [table ] {
240- if ! usedBySelectQuery (cache .info .Targets , queryInfo .Update .Targets ) {
241- // no need to purge because the cache does not contain the updated column
242- continue
243- }
244240 // we should purge all cache
245241 cache .cache .Purge ()
246242 }
@@ -272,16 +268,9 @@ func (c *cacheConn) execDelete(ctx context.Context, queryInfo domains.CachePlanQ
272268 return inner .ExecContext (ctx , queryInfo .Query , args )
273269 }
274270
275- uniqueValue := args [queryInfo .Delete .Conditions [0 ].Placeholder .Index ]
276-
277271 for _ , cache := range cacheByTable [table ] {
278- if cache .uniqueOnly {
279- // query like "SELECT * FROM table WHERE pk = ?"
280- // we should forget the cache
281- cache .cache .Forget (cacheKey ([]driver.Value {uniqueValue .Value }))
282- } else {
283- cache .cache .Purge ()
284- }
272+ cache .cache .Purge ()
273+
285274 }
286275
287276 return inner .ExecContext (ctx , queryInfo .Query , args )
Original file line number Diff line number Diff line change @@ -237,10 +237,6 @@ func (c *cacheConn) execUpdate(ctx context.Context, queryInfo domains.CachePlanQ
237237 }
238238 if !updateByUnique {
239239 for _, cache := range cacheByTable[table] {
240- if !usedBySelectQuery(cache.info.Targets , queryInfo.Update.Targets ) {
241- // no need to purge because the cache does not contain the updated column
242- continue
243- }
244240 // we should purge all cache
245241 cache.cache.Purge ()
246242 }
@@ -272,16 +268,9 @@ func (c *cacheConn) execDelete(ctx context.Context, queryInfo domains.CachePlanQ
272268 return inner.ExecContext (ctx, queryInfo.Query , args)
273269 }
274270
275- uniqueValue := args[queryInfo.Delete.Conditions [0].Placeholder.Index ]
276-
277271 for _, cache := range cacheByTable[table] {
278- if cache.uniqueOnly {
279- // query like " SELECT * FROM table WHERE pk = ?"
280- // we should forget the cache
281- cache.cache.Forget (cacheKey([]driver.Value {uniqueValue.Value }))
282- } else {
283- cache.cache.Purge ()
284- }
272+ cache.cache.Purge ()
273+
285274 }
286275
287276 return inner.ExecContext (ctx, queryInfo.Query , args)
You can’t perform that action at this time.
0 commit comments