Exemple #1
0
// NewRedisDeviceStore creates a new Redis-based Device store
func NewRedisDeviceStore(client *redis.Client, prefix string) *RedisDeviceStore {
	if prefix == "" {
		prefix = defaultRedisPrefix
	}
	store := storage.NewRedisMapStore(client, prefix+":"+redisDevicePrefix)
	store.SetBase(Device{}, "")
	return &RedisDeviceStore{
		store: store,
	}
}
Exemple #2
0
// NewRedisApplicationStore creates a new Redis-based Application store
// if an empty prefix is passed, a default prefix will be used.
func NewRedisApplicationStore(client *redis.Client, prefix string) Store {
	if prefix == "" {
		prefix = defaultRedisPrefix
	}
	store := storage.NewRedisMapStore(client, prefix+":"+redisApplicationPrefix)
	store.SetBase(Application{}, "")
	return &RedisApplicationStore{
		store: store,
	}
}
Exemple #3
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),
	}
}