Skip to content

Commit

Permalink
Added some documentation for set_rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
viperet committed Mar 30, 2012
1 parent 3703a5e commit f091d5b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions doc/HttpSetMiscModule.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,38 @@ For now, there's no way to configure a custom random generator seed.
Behind the scene, it makes use of the standard C function <code>rand()</code>.
== set_rotate ==
'''syntax:''' ''set_random $value <from> <to>''
'''default:''' ''no''
'''context:''' ''location, location if''
'''phase:''' ''rewrite''
Increments <code>$value</code> but keeps it in range from <code>$from</code> to <code>$to</code>.
If <code>$value</code> is greater than <code>$to</code> or less than <code>$from</code> is will be
set to <code>$from</code> value.
Only non-negative numbers are allowed for the <code><from></code> and <code><to></code> arguments.
When <code><$from></code> is greater than <code><$to></code>, their values will be exchanged accordingly.
For instance,
<geshi lang="nginx">
location /rotate {
default_type text/plain;
set $counter $cookie_counter;
set_rotate $counter 1 5;
echo $counter;
add_header Set-Cookie counter=$counter;
}
</geshi>
then request <code>GET /rotate</code> will output next number between 1 and 5 (i.e., 1, 2, 3, 4, 5) on each
refresh of the page. This directive may be userful for banner rotation purposes.
== set_local_today ==
'''syntax:''' ''set_local_today $dst''
Expand Down

0 comments on commit f091d5b

Please sign in to comment.