I understood that if you have only strings in a map directive the access
time is O(1).
What if you have the hostnames directive enabled and some of the items
are
in the format *.example.com?
What about if you mix with regular expressions?
On Sat, Sep 03, 2011 at 05:11:07PM +0300, Calin D. wrote:
Hi,
I understood that if you have only strings in a map directive the access
time is O(1).
Yes.
What if you have the hostnames directive enabled and some of the items are
in the format *.example.com?
nginx tests address by its parts, first “com”, then “example”.
So access of the operation varies from O(1) to O(N) where N is number of
parts of longest name. For example, if you test example.net only against
*.example.com
*.sub.domain.com
then this will be O(1). If you test www.sub.domain.com, it will be O(3).
What about if you mix with regular expressions?
The regular expressions tested sequentially.
nginx tests map in the following order:
exact names,
*.names,
names.*,
regexes.
The first match stops the tesing.
–
Igor S.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.