$Web Expire: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 4: Line 4:




$Web_Expire sets the expiration date and time for the Web Server response entity being returned by the application. Using $WEB_EXPIRE, you can control how long a browser caches an entity returned by your application.
<var>$Web_Expire</var> sets the expiration date and time for the Web Server response entity being returned by the application. Using $WEB_EXPIRE, you can control how long a browser caches an entity returned by your application.
==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" /> %RC = $Web_Expire( exp_time )
<p class="syntax"><section begin="syntax" /> %RC = $Web_Expire( exp_time )
Line 10: Line 10:




$Web_Expire requires one argument and returns a numeric status code. It is also callable (see [[Calling_Sirius_Mods_$functions|Calling Sirius Mods $functions]]).
<var>$Web_Expire</var> requires one argument and returns a numeric status code. It is also callable (see [[Calling_Sirius_Mods_$functions|Calling Sirius Mods $functions]]).
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>exp_time</th>
<tr><th>exp_time</th>
Line 30: Line 30:




Use $Web_Expire to control how long a browser caches an entity returned by your application.
Use <var>$Web_Expire</var> to control how long a browser caches an entity returned by your application.
<p class="code"> * Get current date in binary
<p class="code"> * Get current date in binary
   
   
Line 45: Line 45:
   
   
  * Changed my mind, only cache URL for 1 hour.
  * Changed my mind, only cache URL for 1 hour.
  * The previous $Web_Expire call is forgotten.
  * The previous <var>$Web_Expire</var> call is forgotten.
   
   
  %X = %X - (7*24-1)*60*60
  %X = %X - (7*24-1)*60*60
Line 53: Line 53:




In the above example, $Web_Expire is called to set the expiration date for the response entity. A second $Web_Expire demonstrates that you can override the $Web_Expire value any time you wish.  
In the above example, <var>$Web_Expire</var> is called to set the expiration date for the response entity. A second <var>$Web_Expire</var> demonstrates that you can override the <var>$Web_Expire</var> value any time you wish.  


See also [[$Web_Last_Modified]] and .
See also [[$Web_Last_Modified]] and .


[[Category:Janus Web Server $functions|$Web_Expire]]
[[Category:Janus Web Server $functions|$Web_Expire]]

Revision as of 20:33, 15 June 2012

<section begin="desc" />Set expiration date/time of Web response<section end="desc" />


$Web_Expire sets the expiration date and time for the Web Server response entity being returned by the application. Using $WEB_EXPIRE, you can control how long a browser caches an entity returned by your application.

Syntax

<section begin="syntax" /> %RC = $Web_Expire( exp_time ) <section end="syntax" />


$Web_Expire requires one argument and returns a numeric status code. It is also callable (see Calling Sirius Mods $functions).

exp_time A date/time expressed in seconds since 12 AM on January 1, 1900. You can use the $WEB_DATENS function to get the current date in this format, and manipulate it using standard User Language expressions.
Code Meaning
0 Completed successfully
-1 Not a web thread
-4 Invalid datetime value

$WEB_EXPIRE return codes


Use $Web_Expire to control how long a browser caches an entity returned by your application.

* Get current date in binary %X = $WEB_DATENS * Add one week to the current date %X = %X + 7*24*60*60 * Ensure browser doesn't cache returned data * longer than one week %RC = $Web_Expire( %X ) * Changed my mind, only cache URL for 1 hour. * The previous $Web_Expire call is forgotten. %X = %X - (7*24-1)*60*60 %RC = $Web_Expire( %X )


In the above example, $Web_Expire is called to set the expiration date for the response entity. A second $Web_Expire demonstrates that you can override the $Web_Expire value any time you wish.

See also $Web_Last_Modified and .