# Class CacheKeyPatterns

Namespace
  adas_core.Domain.Utils

Assembly
  adas-core.Domain.dll

Patrones para DeleteByPattern (Redis) u operaciones masivas por prefijo.

    public static class CacheKeyPatterns

Inheritance
  object
  CacheKeyPatterns

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Methods

### ByDate(string, string)

Builds a formatted string by combining the provided prefix and date with a `:*:` separator, typically used as a key or identifier pattern.

    public static string ByDate(string prefix, string date)

#### Parameters

`prefix` string

  The prefix segment to include at the beginning of the returned string.

`date` string

  The date segment to include at the end of the returned string.

#### Returns

string

  A string formatted as `{prefix}:*:{date}`.

### ByPatient(string, string)

Builds a wildcard search pattern prefixed by the given value and scoped to a specific patient identifier.

    public static string ByPatient(string prefix, string patientId)

#### Parameters

`prefix` string

  The category or context prefix prepended to the pattern.

`patientId` string

  The patient identifier used to scope the wildcard pattern.

#### Returns

string

  A formatted pattern string in the form `{prefix}::{patientId}`.

### ByPrefix(string)

Builds a wildcard search key by appending ":*" to the specified prefix, enabling prefix-based lookups over a hierarchical key namespace.

    public static string ByPrefix(string prefix)

#### Parameters

`prefix` string

  The key prefix to match against.

#### Returns

string

  A formatted string combining `prefix` and ":*" used as a wildcard pattern.

### ForEntity(EntityType)

Returns a cache key pattern corresponding to the specified entity type, mapping each supported entity (Patients, Displays, PumpObservations, Appointments, GroupedObservations, and ConfigObservations) to its dedicated cache key prefix. For any unrecognized entity type, the wildcard pattern "*" is returned as a fallback to target all cache entries.

    public static string ForEntity(CacheEnum.EntityType type)

#### Parameters

`type` CacheEnum.EntityType

  The entity type for which a cache key pattern is being generated.

#### Returns

string

  A string representing the cache key pattern associated with the given entity type, or "*" if the entity type is not recognized.