mirror of
https://github.com/ollama/ollama.git
synced 2026-07-07 00:08:13 +00:00
* Reduce startup model hydration Add a lightweight model list cache for tags and launch inventory, while keeping show cache population lazy. This avoids loading every local model at startup on large model stores. * harden flaky scheduler unit test * remove extra launch model metadata text * review comments * review comments
32 lines
610 B
Go
32 lines
610 B
Go
package server
|
|
|
|
import "context"
|
|
|
|
type modelCaches struct {
|
|
recommendations *modelRecommendationsCache
|
|
show *modelShowCache
|
|
modelList *modelListCache
|
|
}
|
|
|
|
func newModelCaches() *modelCaches {
|
|
return &modelCaches{
|
|
recommendations: newModelRecommendationsCache(),
|
|
show: newModelShowCache(),
|
|
modelList: newModelListCache(),
|
|
}
|
|
}
|
|
|
|
func (c *modelCaches) Start(ctx context.Context) {
|
|
if c == nil {
|
|
return
|
|
}
|
|
if c.recommendations != nil {
|
|
c.recommendations.Start(ctx)
|
|
}
|
|
if c.show != nil {
|
|
c.show.Start(ctx)
|
|
}
|
|
if c.modelList != nil {
|
|
c.modelList.Start(ctx)
|
|
}
|
|
}
|