checkAndRemoveSelectCache checks and removes the cache in insert/update/delete statement if cache feature is enabled.
(ctx context.Context)
| 65 | // checkAndRemoveSelectCache checks and removes the cache in insert/update/delete statement if |
| 66 | // cache feature is enabled. |
| 67 | func (m *Model) checkAndRemoveSelectCache(ctx context.Context) { |
| 68 | if m.cacheEnabled && m.cacheOption.Duration < 0 && len(m.cacheOption.Name) > 0 { |
| 69 | var cacheKey = m.makeSelectCacheKey("") |
| 70 | if _, err := m.db.GetCache().Remove(ctx, cacheKey); err != nil { |
| 71 | intlog.Errorf(ctx, `%+v`, err) |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | func (m *Model) getSelectResultFromCache(ctx context.Context, sql string, args ...any) (result Result, err error) { |
| 77 | if !m.cacheEnabled || m.tx != nil { |
no test coverage detected