Webiant Logo Webiant Logo
  1. No results found.

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

NopCustomerServiceDefaults.cs

using Nop.Core.Caching;

namespace Nop.Services.Customers;

/// 
/// Represents default values related to customer services
/// 
public static partial class NopCustomerServicesDefaults
{
    /// 
    /// Gets a password salt key size
    /// 
    public static int PasswordSaltKeySize => 5;

    /// 
    /// Gets a max username length
    /// 
    public static int CustomerUsernameLength => 100;

    /// 
    /// Gets a default hash format for customer password
    /// 
    public static string DefaultHashedPasswordFormat => "SHA512";

    /// 
    /// Gets default prefix for customer
    /// 
    public static string CustomerAttributePrefix => "customer_attribute_";

    #region Caching defaults

    #region Customer

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : system name
    /// 
    public static CacheKey CustomerBySystemNameCacheKey => new("Nop.customer.bysystemname.{0}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : customer GUID
    /// 
    public static CacheKey CustomerByGuidCacheKey => new("Nop.customer.byguid.{0}");

    #endregion

    #region Customer roles
    
    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : system name
    /// 
    public static CacheKey CustomerRolesBySystemNameCacheKey => new("Nop.customerrole.bysystemname.{0}", CustomerRolesBySystemNamePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CustomerRolesBySystemNamePrefix => "Nop.customerrole.bysystemname.";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : customer identifier
    /// 
    public static CacheKey CustomerRolesCacheKey => new("Nop.customer.customerrole.{0}", CustomerCustomerRolesPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CustomerCustomerRolesPrefix => "Nop.customer.customerrole.";
    
    #endregion

    #region Addresses

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : customer identifier
    /// 
    public static CacheKey CustomerAddressesCacheKey => new("Nop.customer.addresses.{0}", CustomerAddressesPrefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : customer identifier
    /// {1} : address identifier
    /// 
    public static CacheKey CustomerAddressCacheKey => new("Nop.customer.addresses.{0}-{1}", CustomerAddressesByCustomerPrefix, CustomerAddressesPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CustomerAddressesPrefix => "Nop.customer.addresses.";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : customer identifier
    /// 
    public static string CustomerAddressesByCustomerPrefix => "Nop.customer.addresses.{0}";

    #endregion

    #region Customer password

    /// 
    /// Gets a key for caching current customer password lifetime
    /// 
    /// 
    /// {0} : customer identifier
    /// 
    public static CacheKey CustomerPasswordLifetimeCacheKey => new("Nop.customerpassword.lifetime.{0}");

    #endregion

    #endregion
}