// GetMulti get multiple items from cache, returns a map of key: value in bytes.
// It will always return the same length of map from keys give if it returns a multiError
GetMulti get multiple items from cache, returns a map of key: value in bytes.
It will always return the same length of map from keys give if it returns a multiError
// GetMulti get multiple items from cache returns a map of key : value in bytes . // It will always return the same length of map from keys give if it returns a multiError
func (c *Cache) GetMulti(keys ...string) (map[string][]byte, error) {
	conn := c.Pool.Get()
	defer conn.Close()
	var (
		kArgs []interface{}
		data  [][]byte
	)
	out := make(map[string][]byte)
	mErr := make(MultiError)
	for _, key := range keys {
		kArgs = append(kArgs, key)
	}
	data, err := redis.ByteSlices(conn.Do("MGET", kArgs...))
	if err != nil {
		return nil, fmt.Errorf("dscache.Cache.GetMulti: failed %v", err)
	}
	for i, v := range data {
		k := keys[i]
		out[k] = v
		if v == nil {
			mErr[k] = redis.ErrNil
		} else {
			mErr[k] = nil
		}
	}
	if mErr.Count() > 0 {
		return out, mErr
	}
	return out, nil
}
func ( c * Cache ) GetMulti ( keys ... string ) ( map [ string ] [ ] byte , error ) { conn := c . Pool . Get ( ) defer conn . Close ( ) var ( kArgs [ ] interface { } data [ ] [ ] byte ) out := make ( map [ string ] [ ] byte ) mErr := make ( MultiError ) for _ , key := range keys { kArgs = append ( kArgs , key ) } data , err := redis . ByteSlices ( conn . Do ( " " , kArgs ... ) ) if err != nil { return nil , fmt . Errorf ( " " , err ) } for i , v := range data { k := keys [ i ] out [ k ] = v if v == nil { mErr [ k ] = redis . ErrNil } else { mErr [ k ] = nil } } if mErr . Count ( ) > 0 { return out , mErr } return out , nil }
GetMulti get multiple items from cache, returns a map of key: value in bytes.
GetMulti get multiple items from cache returns a map of key : value in bytes .