Member Junction
    Preparing search index...

    Configuration options for the Redis local storage provider.

    Accepts either a Redis connection URL string or an ioredis options object, plus optional MemberJunction-specific settings.

    // Simple URL connection (works with Azure, AWS, self-hosted)
    const config: RedisProviderConfig = {
    url: 'rediss://default:password@my-redis.example.com:6380'
    };

    // Full options object with MJ settings
    const config: RedisProviderConfig = {
    options: {
    host: 'localhost',
    port: 6379,
    password: 'secret',
    tls: {},
    db: 0,
    },
    keyPrefix: 'myapp',
    defaultTTLSeconds: 600,
    };
    interface RedisProviderConfig {
        defaultTTLSeconds?: number;
        enableLogging?: boolean;
        enablePubSub?: boolean;
        keyPrefix?: string;
        maxRetries?: number;
        options?: RedisOptions;
        url?: string;
    }
    Index

    Properties

    defaultTTLSeconds?: number

    Default time-to-live in seconds applied to every SetItem call unless overridden by the ttlSeconds parameter.

    Set to 0 or undefined to store keys without expiration (persistent).

    undefined (no expiration)
    
    enableLogging?: boolean

    Whether to log connection events (connect, disconnect, error) via MemberJunction's LogStatus / LogError functions.

    true
    
    enablePubSub?: boolean

    Whether to enable Redis pub/sub for cross-server cache invalidation. When enabled, the provider will:

    • Publish a CacheChangedEvent on every SetItem, Remove, and ClearCategory call
    • Subscribe (via a dedicated second Redis connection) for events from other servers
    • Emit local events so consumers (like LocalCacheManager) can dispatch to registered callbacks

    Pub/sub is not started automatically — call RedisLocalStorageProvider.StartListening after construction to begin subscribing.

    false
    
    keyPrefix?: string

    Optional prefix prepended to all Redis keys. Useful for isolating MemberJunction data in a shared Redis instance.

    Keys are stored as {keyPrefix}:{category}:{key}.

    'mj'
    
    maxRetries?: number

    Maximum number of connection retry attempts before giving up. Each retry uses exponential backoff (doubling delay up to 30 seconds).

    10
    
    options?: RedisOptions

    Full ioredis options object for fine-grained connection control. Mutually exclusive with url.

    url?: string

    Redis connection URL (e.g., redis://localhost:6379, rediss://user:pass@host:6380). Mutually exclusive with options. The rediss:// scheme enables TLS, which is required for most cloud-hosted Redis services.