MCPcopy
hub / github.com/mudler/LocalAI / publishCacheInvalidate

Method publishCacheInvalidate

core/services/galleryop/service.go:192–202  ·  view source on GitHub ↗

publishCacheInvalidate broadcasts a cache invalidation event so peer replicas refresh whatever in-memory state mirrors disk. No-op when natsClient is not wired (standalone mode).

(subject string, evt messaging.CacheInvalidateEvent)

Source from the content-addressed store, hash-verified

190// replicas refresh whatever in-memory state mirrors disk. No-op when
191// natsClient is not wired (standalone mode).
192func (g *GalleryService) publishCacheInvalidate(subject string, evt messaging.CacheInvalidateEvent) {
193 g.Lock()
194 nc := g.natsClient
195 g.Unlock()
196 if nc == nil {
197 return
198 }
199 if err := nc.Publish(subject, evt); err != nil {
200 xlog.Warn("Failed to broadcast cache invalidation", "subject", subject, "error", err)
201 }
202}
203
204// BroadcastModelsChanged notifies peer replicas that a model config was
205// created, edited, or removed out-of-band of the gallery install/delete

Callers 3

backendHandlerMethod · 0.95
modelHandlerMethod · 0.95

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
PublishMethod · 0.65

Tested by

no test coverage detected