Skip to content

chore: update doc links, fix grammar, fix a commented out test #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package_info.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// Package ldredis provides a Redis-backed persistent data store for the LaunchDarkly Go SDK.
//
// For more details about how and why you can use a persistent data store, see:
// https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store
// https://docs.launchdarkly.com/sdk/concepts/data-stores
//
// To use the Redis data store with the LaunchDarkly client:
//
// import ldredis "github.com/launchdarkly/go-server-sdk-redis-go-redis"
// import ldredis "github.com/launchdarkly/go-server-sdk-redis-go-redis"
//
// config := ld.Config{
// DataStore: ldcomponents.PersistentDataStore(ldredis.DataStore()),
// }
// client, err := ld.MakeCustomClient("sdk-key", config, 5*time.Second)
// config := ld.Config{
// DataStore: ldcomponents.PersistentDataStore(ldredis.DataStore()),
// }
// client, err := ld.MakeCustomClient("sdk-key", config, 5*time.Second)
//
// The default configuration uses an address of localhost:6379. You may customize the configuration
// by using the methods of the ldredis.DataStoreBuilder returned by ldredis.DataStore():
//
// config := ld.Config{
// DataStore: ldcomponents.PersistentDataStore(
// ldredis.DataStore().URL(myRedisURL),
// ).CacheSeconds(30),
// }
// config := ld.Config{
// DataStore: ldcomponents.PersistentDataStore(
// ldredis.DataStore().URL(myRedisURL),
// ).CacheSeconds(30),
// }
//
// Note that CacheSeconds() is not a method of ldredis.DataStoreBuilder, but rather a method of
// ldcomponents.PersistentDataStore(), because the caching behavior is provided by the SDK for
Expand All @@ -32,5 +32,5 @@
// If you are also using Redis for other purposes, the data store can coexist with
// other data as long as you are not using the same keys. By default, the keys used by the
// data store will always start with "launchdarkly:"; you can change this to another
// prefix if desired.
// prefix if desired using the ldredis.DataStoreBuilder's Prefix method.
package ldredis
8 changes: 4 additions & 4 deletions redis_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func DataStore() *DataStoreBuilder {
//
// config.DataStore = ldredis.DataStore().URL("redis://hostname").Prefix("prefix")
//
// You do not need to call the builder's CreatePersistentDataStore() method yourself to build the
// You do not need to call the builder's Build() method yourself to build the
// actual data store; that will be done by the SDK.
type DataStoreBuilder struct {
prefix string
Expand Down Expand Up @@ -114,7 +114,7 @@ func (b *DataStoreBuilder) Prefix(prefix string) *DataStoreBuilder {
return b
}

// Options sets all of the parameters supported by the go-redis UniversalOptions type.
// Options sets all the parameters supported by the go-redis UniversalOptions type.
//
// This overwrites any previous setting of HostAndPort or Addresses.
func (b *DataStoreBuilder) Options(options redis.UniversalOptions) *DataStoreBuilder {
Expand All @@ -124,7 +124,7 @@ func (b *DataStoreBuilder) Options(options redis.UniversalOptions) *DataStoreBui

// URL specifies the Redis host URL. If not specified, the default value is DefaultURL.
//
// Note that some Redis client features can specified either as part of the URL or with Options. For instance,
// Note that some Redis client features can be specified either as part of the URL or with Options. For instance,
// the Password and DB fields in Options can be part of a "redis://" URL
// (https://www.iana.org/assignments/uri-schemes/prov/redis), and TLS can be enabled either by setting the
// TLSConfig in Options or by using a "rediss://" URL (https://www.iana.org/assignments/uri-schemes/prov/rediss).
Expand Down Expand Up @@ -153,7 +153,7 @@ func (b *DataStoreBuilder) Build(

if b.url != "" {
if len(redisOpts.Addrs) > 0 {
return nil, errors.New("Redis data store must be configured with either Options.Address or URL, but not both")
return nil, errors.New("redis data store must be configured with either Options.Address or URL, but not both")
}
parsed, err := redis.ParseURL(b.url)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion redis_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func TestDataSourceBuilder(t *testing.T) {

assert.Equal(t, DefaultPrefix, makeStore(DataStore().Prefix("")).prefix)

// assert.Equal(t, DefaultClusterPrefix + "p", makeStore(DataStore().Prefix("p").))
assert.Equal(t, DefaultClusterPrefix+"p", makeStore(
DataStore().Addresses("a", "b").Prefix("p")).prefix,
)
})

t.Run("URL", func(t *testing.T) {
Expand Down