src/includes/traits/CacheMembers.php
protected function cacheUnsetByRefPattern(string $primary_key, string $ref_key_pattern)
    {
        if (empty($this->x___cache['x___refs'][$primary_key])) {
            return; // Nothing to do here.
        }
        $ref_key_regex = // Allow `**` to indicate everything quickly.
            $ref_key_pattern === '**' ? '' : $this->c::wRegx($ref_key_pattern, '/', true);

        if (!$ref_key_regex && $ref_key_pattern !== '**') {
            return; // Nothing to do; i.e., no regex.
        }
        foreach (array_keys($this->x___cache['x___refs'][$primary_key]) as $_ref_key) {
            if ($ref_key_pattern === '**' || preg_match($ref_key_regex.'i', (string) $_ref_key)) {
                foreach (array_keys($this->x___cache['x___refs'][$primary_key][$_ref_key]) as $_key) {
                    $this->x___cache['x___refs'][$primary_key][$_ref_key][$_key] = null;
                } // unset($_key); // Housekeeping.
                unset($this->x___cache['x___refs'][$primary_key][$_ref_key]);
            }
        } // unset($_ref_key); // Housekeeping.
    }
protected function cacheUnsetByRefPattern(string $primary_key, string $ref_key_pattern)
    {
        if (empty($this->x___cache['x___refs'][$primary_key])) {
            return; // Nothing to do here.
        }
        $ref_key_regex = // Allow `**` to indicate everything quickly.
            $ref_key_pattern === '**' ? '' : $this->c::wRegx($ref_key_pattern, '/', true);

        if (!$ref_key_regex && $ref_key_pattern !== '**') {
            return; // Nothing to do; i.e., no regex.
        }
        foreach (array_keys($this->x___cache['x___refs'][$primary_key]) as $_ref_key) {
            if ($ref_key_pattern === '**' || preg_match($ref_key_regex.'i', (string) $_ref_key)) {
                foreach (array_keys($this->x___cache['x___refs'][$primary_key][$_ref_key]) as $_key) {
                    $this->x___cache['x___refs'][$primary_key][$_ref_key][$_key] = null;
                } // unset($_key); // Housekeeping.
                unset($this->x___cache['x___refs'][$primary_key][$_ref_key]);
            }
        } // unset($_ref_key); // Housekeeping.
    }
Unset a cache ref-key pattern.

@since 150424 Initial release.

@param string $primary_key     Primary key.
@param string $ref_key_pattern Ref-key pattern (watered-down regex).