func()

in internal/utils/controller/cache_helper.go [43:66]


func (c *AppCacheField) NewCacheKey() string {
	hasher := sha256.New()
	hasher.Write([]byte(c.Name))
	hasher.Write([]byte(c.Image))
	hasher.Write([]byte(strings.Join(c.Command, " ")))
	hasher.Write([]byte(strings.Join(c.Args, " ")))
	hasher.Write([]byte(c.WorkingDir))

	// Sort environment variables to ensure consistent hashing
	sort.Slice(c.Env, func(i, j int) bool {
		return c.Env[i].Name < c.Env[j].Name
	})
	for _, env := range c.Env {
		hasher.Write([]byte(env.Name + "=" + env.Value))
	}

	// Sort dependencies to ensure consistent hashing
	sort.Strings(c.Dependencies)
	for _, dep := range c.Dependencies {
		hasher.Write([]byte(dep))
	}

	return hex.EncodeToString(hasher.Sum(nil))
}