Skip to content

Commit

Permalink
""
Browse files Browse the repository at this point in the history
git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@85 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information
Claes Wikstrom committed Jun 15, 2002
1 parent 11f8897 commit 6c9c37f
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions man/yaws.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ used for cached RAM files. The default value is 1000000, 1 megabyte.
This directive sets a maximum size on the files that are RAM cached by yaws.
The default value i 8000, 8 kBytes.
.TP
\fB cache_refresh_secs = Integer\fR
The RAM cache is used to serve pages that sit in the cache. An entry sits in
cache at most cache_refresh_secs number of seconds. The default is 30. This means that when the content is updated under the docroot, that change doesn't show
until 30 seconds have passed. While developing a yaws site,
it may be convinient to set this value to 0.
.TP
\fB trace = traffic | http\fR
This enables traffic or http tracing. Tracing is also possible to enable with
a command line flag to yaws.
Expand Down
1 change: 1 addition & 0 deletions src/yaws.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
max_num_cached_files = 400,
max_num_cached_bytes = 1000000, %% 1 MEG
max_size_cached_file = 8000,
cache_refresh_secs = 30, % seconds
default_type = "text/html",
timeout = 2000,
include_dir = [],
Expand Down
1 change: 1 addition & 0 deletions src/yaws_compile.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@


comp_opts(GC) ->
?Debug("I=~p~n", [GC#gconf.include_dir]),
I = lists:map(fun(Dir) -> {i, Dir} end, GC#gconf.include_dir),
YawsDir = {i, "/home/klacke/yaws/include"},
I2 = [YawsDir | I],
Expand Down
8 changes: 8 additions & 0 deletions src/yaws_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ fload(FD, globals, GC, C, Cs, Lno, Chars) ->
{error, ?F("Expect integer at line ~w", [Lno])}
end;

["cache_refresh_secs", '=', Val] ->
case (catch list_to_integer(Val)) of
I when integer(I), I >= 0 ->
fload(FD, globals, GC#gconf{cache_refresh_secs = I},
C, Cs, Lno+1, Next);
_ ->
{error, ?F("Expect 0 or positive integer at line ~w", [Lno])}
end;


['<', "server", Server, '>'] -> %% first server
Expand Down
7 changes: 5 additions & 2 deletions src/yaws_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1424,15 +1424,18 @@ url_type(GC, SC, Path) ->
[{_, When, UT}] ->
N = now_secs(),
FI = UT#urltype.finfo,
if
When + 30 > N ->
Refresh = GC#gconf.cache_refresh_secs,
if
((N-When) > Refresh) ->
?Debug("Timed out entry for ~s ~p~n", [Path, {When, N}]),
%% more than 30 secs old entry
ets:delete(E, {url, Path}),
ets:delete(E, {urlc, Path}),
ets:update_counter(E, num_files, -1),
ets:update_counter(E, num_bytes, -FI#file_info.size),
url_type(GC, SC, Path);
true ->
?Debug("Serve page from cache ~p", [{When , N, N-When}]),
ets:update_counter(E, {urlc, Path}, 1),
UT
end
Expand Down
2 changes: 1 addition & 1 deletion www/small.yaws
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<erl>
out(_) -> {html, "X"}.
out(_) -> {html, "XXXX"}.
</erl>
2 changes: 1 addition & 1 deletion www/static.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<IMG SRC="/xxåäöxx.jpg" HEIGHT=40 WIDTH="400" ALT="HYBER LOGO">


<p> no content
<p> nano content

</html>

0 comments on commit 6c9c37f

Please sign in to comment.