func NewUserCache()

in aucoalesce/id_lookup.go [57:86]


func NewUserCache(expiration time.Duration) *EntityCache {
	return &EntityCache{
		byID: stringCache{
			expiration: expiration,
			data: map[string]stringItem{
				"0": {timeout: noExpiration, value: "root"},
			},
			lookupFn: func(s string) string {
				user, err := user.LookupId(s)
				if err != nil {
					return ""
				}
				return user.Username
			},
		},
		byName: stringCache{
			expiration: expiration,
			data: map[string]stringItem{
				"root": {timeout: noExpiration, value: "0"},
			},
			lookupFn: func(s string) string {
				user, err := user.Lookup(s)
				if err != nil {
					return ""
				}
				return user.Uid
			},
		},
	}
}