Home / Function/ unquoteCacheDirective() — fiber Function Reference

unquoteCacheDirective() — fiber Function Reference

Architecture documentation for the unquoteCacheDirective() function in cache.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  c66cadd8_8dfa_8564_6109_273f445a3b79["unquoteCacheDirective()"]
  af95e058_7e86_ec88_42f0_cd294e342508["cache.go"]
  c66cadd8_8dfa_8564_6109_273f445a3b79 -->|defined in| af95e058_7e86_ec88_42f0_cd294e342508
  7bb90993_ff5b_fab9_386a_48b814aa152a["parseCacheControlDirectives()"]
  7bb90993_ff5b_fab9_386a_48b814aa152a -->|calls| c66cadd8_8dfa_8564_6109_273f445a3b79
  style c66cadd8_8dfa_8564_6109_273f445a3b79 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache.go lines 1011–1046

func unquoteCacheDirective(quoted []byte) []byte {
	if len(quoted) < 2 {
		return quoted
	}

	// Remove surrounding quotes
	inner := quoted[1 : len(quoted)-1]

	// Check if there are any escaped characters (backslash followed by another character)
	hasEscapes := false
	for i := 0; i < len(inner)-1; i++ {
		if inner[i] == '\\' {
			hasEscapes = true
			break
		}
	}

	// If no escapes, return the inner content directly
	if !hasEscapes {
		return inner
	}

	// Process escaped characters
	result := make([]byte, 0, len(inner))
	for i := 0; i < len(inner); i++ {
		if inner[i] == '\\' && i+1 < len(inner) {
			// Skip the backslash and take the next character
			i++
			result = append(result, inner[i])
		} else {
			result = append(result, inner[i])
		}
	}

	return result
}

Subdomains

Frequently Asked Questions

What does unquoteCacheDirective() do?
unquoteCacheDirective() is a function in the fiber codebase, defined in middleware/cache/cache.go.
Where is unquoteCacheDirective() defined?
unquoteCacheDirective() is defined in middleware/cache/cache.go at line 1011.
What calls unquoteCacheDirective()?
unquoteCacheDirective() is called by 1 function(s): parseCacheControlDirectives.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free