Exemplo n.º 1
0
func newScripts(config *Config) *scripts {
	return &scripts{
		config:         config,
		deliverScript:  redis.NewScript(1, FairwayDeliver()),
		pullScript:     redis.NewScript(4, FairwayPull()),
		inflightScript: redis.NewScript(1, FairwayInflight()),
		pingScript:     redis.NewScript(3, FairwayPing()),
		ackScript:      redis.NewScript(1, FairwayAck()),
	}
}
Exemplo n.º 2
0
func (s *scripts) findScript(script func() string, keyCount int) *redis.Script {
	content := script()

	if s.data[content] == nil {
		s.data[content] = redis.NewScript(keyCount, content)
	}

	return s.data[content]
}