Empty out all channel caches.
(ctx context.Context)
| 238 | |
| 239 | // Empty out all channel caches. |
| 240 | func (c *changeCache) Clear(ctx context.Context) error { |
| 241 | c.lock.Lock() |
| 242 | defer c.lock.Unlock() |
| 243 | |
| 244 | // Reset initialSequence so that any new channel caches have their validFrom set to the current last sequence |
| 245 | // the point at which the change cache was initialized / re-initialized. |
| 246 | // No need to touch c.nextSequence here, because we don't want to touch the sequence buffering state. |
| 247 | var err error |
| 248 | c.initialSequence, err = c.db.LastSequence(ctx) |
| 249 | if err != nil { |
| 250 | return err |
| 251 | } |
| 252 | |
| 253 | c.pendingLogs = nil |
| 254 | heap.Init(&c.pendingLogs) |
| 255 | |
| 256 | c.initTime = time.Now() |
| 257 | |
| 258 | c.channelCache.Clear() |
| 259 | return nil |
| 260 | } |
| 261 | |
| 262 | // If set to false, DocChanged() becomes a no-op. |
| 263 | func (c *changeCache) EnableChannelIndexing(enable bool) { |
nothing calls this directly
no test coverage detected