...

Text file src/github.com/launchdarkly/go-server-sdk-redis-redigo/v2/README.md

Documentation: github.com/launchdarkly/go-server-sdk-redis-redigo/v2

     1# LaunchDarkly Server-side SDK for Go - Redis integration with Redigo client
     2
     3[![Circle CI](https://circleci.com/gh/launchdarkly/go-server-sdk-redis-redigo.svg?style=shield)](https://circleci.com/gh/launchdarkly/go-server-sdk-redis-redigo) [![Documentation](https://img.shields.io/static/v1?label=go.dev&message=reference&color=00add8)](https://pkg.go.dev/github.com/launchdarkly/go-server-sdk-redis-redigo/v2)
     4
     5This library provides a [Redis](https://redis.io/)-backed persistence mechanism (data store) for the [LaunchDarkly Go SDK](https://github.com/launchdarkly/go-server-sdk), replacing the default in-memory data store.
     6
     7The Redis API implementation it uses is [Redigo](https://github.com/gomodule/redigo). There are other Redis client implementations for Go; if LaunchDarkly SDK Redis integrations using other Redis clients are released, they will be in separate repositories.
     8
     9This version of the library requires at least version 6.0.0 of the LaunchDarkly Go SDK; for versions of the library to use with earlier SDK versions, see the changelog.
    10
    11The minimum Go version is 1.18.
    12
    13For more information, see also: [Using a persistent feature store](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store).
    14
    15## Quick setup
    16
    17This assumes that you have already installed the LaunchDarkly Go SDK.
    18
    191. Import the LaunchDarkly SDK packages and the package for this library:
    20
    21```go
    22import (
    23    ld "github.com/launchdarkly/go-server-sdk/v6"
    24    "github.com/launchdarkly/go-server-sdk/v6/ldcomponents"
    25    ldredis "github.com/launchdarkly/go-server-sdk-redis-redigo/v2"
    26)
    27```
    28
    292. When configuring your SDK client, add the Redis data store as a `PersistentDataStore`. You may specify any custom Redis options using the methods of `RedisDataStoreBuilder`. For instance, to customize the Redis URL:
    30
    31```go
    32    var config ld.Config{}
    33    config.DataStore = ldcomponents.PersistentDataStore(
    34        ldredis.DataStore().URL("redis://my-redis-host"),
    35    )
    36```
    37
    38By default, the store will try to connect to a local Redis instance on port 6379.
    39
    40## Caching behavior
    41
    42The LaunchDarkly SDK has a standard caching mechanism for any persistent data store, to reduce database traffic. This is configured through the SDK's `PersistentDataStoreBuilder` class as described the SDK documentation. For instance, to specify a cache TTL of 5 minutes:
    43
    44```go
    45    var config ld.Config{}
    46    config.DataStore = ldcomponents.PersistentDataStore(
    47        ldredis.DataStore(),
    48    ).CacheMinutes(5)
    49```
    50
    51## LaunchDarkly overview
    52
    53[LaunchDarkly](https://www.launchdarkly.com) is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. [Get started](https://docs.launchdarkly.com/docs/getting-started) using LaunchDarkly today!
    54
    55## About LaunchDarkly
    56
    57* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard.  With LaunchDarkly, you can:
    58    * Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    59    * Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    60    * Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    61    * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
    62* LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/docs) for a complete list.
    63* Explore LaunchDarkly
    64    * [launchdarkly.com](https://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
    65    * [docs.launchdarkly.com](https://docs.launchdarkly.com/  "LaunchDarkly Documentation") for our documentation and SDK reference guides
    66    * [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/  "LaunchDarkly API Documentation") for our API documentation
    67    * [blog.launchdarkly.com](https://blog.launchdarkly.com/  "LaunchDarkly Blog Documentation") for the latest product updates

View as plain text