Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

""

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@85 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
commit 6c9c37f2a816fbbb213d7cb75f58a13dd7753911 1 parent 11f8897
@klacke authored
View
6 man/yaws.conf.5
@@ -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.
View
1  src/yaws.hrl
@@ -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 = [],
View
1  src/yaws_compile.erl
@@ -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],
View
8 src/yaws_config.erl
@@ -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
View
7 src/yaws_server.erl
@@ -1424,8 +1424,10 @@ 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}),
@@ -1433,6 +1435,7 @@ url_type(GC, SC, Path) ->
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
View
2  www/small.yaws
@@ -1,3 +1,3 @@
<erl>
- out(_) -> {html, "X"}.
+ out(_) -> {html, "XXXX"}.
</erl>
View
2  www/static.html
@@ -10,7 +10,7 @@
<IMG SRC="/xxåäöxx.jpg" HEIGHT=40 WIDTH="400" ALT="HYBER LOGO">
-<p> no content
+<p> nano content
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.