Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

DistributedCacheConfig.cs

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Nop.Core.Configuration;

/// 
/// Represents distributed cache configuration parameters
/// 
public partial class DistributedCacheConfig : IConfig
{
    /// 
    /// Gets or sets a distributed cache type
    /// 
    [JsonConverter(typeof(StringEnumConverter))]
    public DistributedCacheType DistributedCacheType { get; protected set; } = DistributedCacheType.RedisSynchronizedMemory;

    /// 
    /// Gets or sets a value indicating whether we should use distributed cache
    /// 
    public bool Enabled { get; protected set; } = false;

    /// 
    /// Gets or sets connection string. Used when distributed cache is enabled
    /// 
    public string ConnectionString { get; protected set; } = "127.0.0.1:6379,ssl=False";

    /// 
    /// Gets or sets schema name. Used when distributed cache is enabled and DistributedCacheType property is set as SqlServer
    /// 
    public string SchemaName { get; protected set; } = "dbo";

    /// 
    /// Gets or sets table name. Used when distributed cache is enabled and DistributedCacheType property is set as SqlServer
    /// 
    public string TableName { get; protected set; } = "DistributedCache";

    /// 
    /// Gets or sets instance name. Used when distributed cache is enabled and DistributedCacheType property is set as Redis or RedisSynchronizedMemory.
    /// Useful when one wants to partition a single Redis server for use with multiple apps, e.g. by setting InstanceName to "development" and "production".
    /// 
    public string InstanceName { get; protected set; } = "nopCommerce";

    /// 
    /// Gets or sets the Redis event publish interval in milliseconds.
    /// Used when distributed cache is enabled and DistributedCacheType property is set as RedisSynchronizedMemory.
    /// If greater than zero, events will be buffered for this long before being published in batch, in order to reduce server load.
    /// If zero, events are published when they are raised, without buffering.
    /// 
    public int PublishIntervalMs { get; protected set; } = 500;
}