func FlushMACCommandQueue(ctx context.Context, devEUI lorawan.EUI64) error {
	key := GetRedisKey(macCommandQueueTempl, devEUI)
	err := RedisClient().Del(ctx, key).Err()
	if err != nil {
		return errors.Wrap(err, "flush mac-command queue error")
	}
	return nil
}
FlushMACCommandQueue flushes the mac-command queue for the given DevEUI.
package storage
import (
	"bytes"
	"context"
	"encoding/gob"
	"github.com/go-redis/redis/v8"
	"github.com/pkg/errors"
	log "github.com/sirupsen/logrus"
	"github.com/brocaar/chirpstack-network-server/v3/internal/logging"
	"github.com/brocaar/lorawan"
)
const (
	macCommandQueueTempl   = "lora:ns:device:%s:mac:queue"
	macCommandPendingTempl = "lora:ns:device:%s:mac:pending:%d"
)
type MACCommandBlock struct {
	CID         lorawan.CID
	External    bool  
	MACCommands MACCommands
}
func (m *MACCommandBlock) Size() (int, error) {
	var count int
	for _, mc := range m.MACCommands {
		b, err := mc.MarshalBinary()
		if err != nil {
			return 0, errors.Wrap(err, "marshal binary error")
		}
		count += len(b)
	}
	return count, nil
}
type MACCommands []lorawan.MACCommand
func (m MACCommands) MarshalBinary() ([]byte, error) {
	var out []byte
	for _, mac := range m {
		b, err := mac.MarshalBinary()
		if err != nil {
			return nil, err
		}
		out = append(out, b...)
	}
	return out, nil
}
func (m *MACCommands) UnmarshalBinary(data []byte) error {
	var pLen int
	for i := 0; i < len(data); i++ {
		if _, s, err := lorawan.GetMACPayloadAndSize(false, lorawan.CID(data[i])); err != nil {
			pLen = 0
		} else {
			pLen = s
		}
		if len(data[i:]) < pLen+1 {
			return errors.New("not enough remaining bytes")
		}
		var mc lorawan.MACCommand
		if err := mc.UnmarshalBinary(false, data[i:i+1+pLen]); err != nil {
			return err
		}
		*m = append(*m, mc)
		i += pLen
	}
	return nil
}