Exemplo n.º 1
0
// NewRedisDeviceStore creates a new Redis-based status store
func NewRedisDeviceStore(client *redis.Client, prefix string) Store {
	if prefix == "" {
		prefix = defaultRedisPrefix
	}
	store := storage.NewRedisMapStore(client, prefix+":"+redisDevicePrefix)
	store.SetBase(Device{}, "")

	return &RedisDeviceStore{
		store:        store,
		devAddrIndex: storage.NewRedisSetStore(client, prefix+":"+redisDevAddrPrefix),
	}
}
Exemplo n.º 2
0
// NewRedisAnnouncementStore creates a new Redis-based Announcement store
func NewRedisAnnouncementStore(client *redis.Client, prefix string) Store {
	if prefix == "" {
		prefix = defaultRedisPrefix
	}
	store := storage.NewRedisMapStore(client, prefix+":"+redisAnnouncementPrefix)
	store.SetBase(Announcement{}, "")
	return &RedisAnnouncementStore{
		store:    store,
		metadata: storage.NewRedisSetStore(client, prefix+":"+redisMetadataPrefix),
		byAppID:  storage.NewRedisKVStore(client, prefix+":"+redisAppIDPrefix),
		byAppEUI: storage.NewRedisKVStore(client, prefix+":"+redisAppEUIPrefix),
	}
}