Home / Function/ hasDirective() — fiber Function Reference

hasDirective() — fiber Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  de131d33_14bf_b0ce_186c_daf7c86d2bac["hasDirective()"]
  af95e058_7e86_ec88_42f0_cd294e342508["cache.go"]
  de131d33_14bf_b0ce_186c_daf7c86d2bac -->|defined in| af95e058_7e86_ec88_42f0_cd294e342508
  96447356_67b9_a364_148e_b703c487e1ba["New()"]
  96447356_67b9_a364_148e_b703c487e1ba -->|calls| de131d33_14bf_b0ce_186c_daf7c86d2bac
  style de131d33_14bf_b0ce_186c_daf7c86d2bac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/cache/cache.go lines 908–927

func hasDirective(cc, directive string) bool {
	ccLen := len(cc)
	dirLen := len(directive)
	for i := 0; i <= ccLen-dirLen; i++ {
		if !utils.EqualFold(cc[i:i+dirLen], directive) {
			continue
		}
		if i > 0 {
			prev := cc[i-1]
			if prev != ' ' && prev != ',' {
				continue
			}
		}
		if i+dirLen == ccLen || cc[i+dirLen] == ',' {
			return true
		}
	}

	return false
}

Subdomains

Called By

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free