package redisdb import ( "context" ) // GetWithPrefixPattern ... func (s Server) GetWithPrefixPattern(pattern string) (keys []string, values []string) { // Init keys = make([]string, 0) values = make([]string, 0) var ( ctx = context.Background() cursor uint64 err error ) keys, cursor, err = s.rdb.Scan(ctx, cursor, pattern, 1000000).Result() if err != nil { return } if len(keys) == 0 { return } // Get value for _, key := range keys { value := s.GetValueByKey(ctx, key) values = append(values, value) } return }