aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cgit.c15
-rw-r--r--cgit.h1
-rw-r--r--cgitrc.5.txt28
3 files changed, 31 insertions, 13 deletions
diff --git a/cgit.c b/cgit.c
index 950b878..a45ce1f 100644
--- a/cgit.c
+++ b/cgit.c
@@ -211,6 +211,8 @@ static void config_cb(const char *name, const char *value)
211 ctx.cfg.cache_static_ttl = atoi(value); 211 ctx.cfg.cache_static_ttl = atoi(value);
212 else if (!strcmp(name, "cache-dynamic-ttl")) 212 else if (!strcmp(name, "cache-dynamic-ttl"))
213 ctx.cfg.cache_dynamic_ttl = atoi(value); 213 ctx.cfg.cache_dynamic_ttl = atoi(value);
214 else if (!strcmp(name, "cache-about-ttl"))
215 ctx.cfg.cache_about_ttl = atoi(value);
214 else if (!strcmp(name, "case-sensitive-sort")) 216 else if (!strcmp(name, "case-sensitive-sort"))
215 ctx.cfg.case_sensitive_sort = atoi(value); 217 ctx.cfg.case_sensitive_sort = atoi(value);
216 else if (!strcmp(name, "about-filter")) 218 else if (!strcmp(name, "about-filter"))
@@ -351,12 +353,13 @@ static void prepare_context(struct cgit_context *ctx)
351 ctx->cfg.agefile = "info/web/last-modified"; 353 ctx->cfg.agefile = "info/web/last-modified";
352 ctx->cfg.nocache = 0; 354 ctx->cfg.nocache = 0;
353 ctx->cfg.cache_size = 0; 355 ctx->cfg.cache_size = 0;
354 ctx->cfg.cache_dynamic_ttl = 5;
355 ctx->cfg.cache_max_create_time = 5; 356 ctx->cfg.cache_max_create_time = 5;
356 ctx->cfg.cache_repo_ttl = 5;
357 ctx->cfg.cache_root = CGIT_CACHE_ROOT; 357 ctx->cfg.cache_root = CGIT_CACHE_ROOT;
358 ctx->cfg.cache_about_ttl = 15;
359 ctx->cfg.cache_repo_ttl = 5;
358 ctx->cfg.cache_root_ttl = 5; 360 ctx->cfg.cache_root_ttl = 5;
359 ctx->cfg.cache_scanrc_ttl = 15; 361 ctx->cfg.cache_scanrc_ttl = 15;
362 ctx->cfg.cache_dynamic_ttl = 5;
360 ctx->cfg.cache_static_ttl = -1; 363 ctx->cfg.cache_static_ttl = -1;
361 ctx->cfg.case_sensitive_sort = 1; 364 ctx->cfg.case_sensitive_sort = 1;
362 ctx->cfg.branch_sort = 0; 365 ctx->cfg.branch_sort = 0;
@@ -922,6 +925,9 @@ static int calc_ttl()
922 if (!ctx.qry.page) 925 if (!ctx.qry.page)
923 return ctx.cfg.cache_repo_ttl; 926 return ctx.cfg.cache_repo_ttl;
924 927
928 if (!strcmp(ctx.qry.page, "about"))
929 return ctx.cfg.cache_about_ttl;
930
925 if (ctx.qry.has_symref) 931 if (ctx.qry.has_symref)
926 return ctx.cfg.cache_dynamic_ttl; 932 return ctx.cfg.cache_dynamic_ttl;
927 933
@@ -973,7 +979,10 @@ int main(int argc, const char **argv)
973 } 979 }
974 980
975 ttl = calc_ttl(); 981 ttl = calc_ttl();
976 ctx.page.expires += ttl * 60; 982 if (ttl < 0)
983 ctx.page.expires += 10 * 365 * 24 * 60 * 60; /* 10 years */
984 else
985 ctx.page.expires += ttl * 60;
977 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD")) 986 if (ctx.env.request_method && !strcmp(ctx.env.request_method, "HEAD"))
978 ctx.cfg.nocache = 1; 987 ctx.cfg.nocache = 1;
979 if (ctx.cfg.nocache) 988 if (ctx.cfg.nocache)
diff --git a/cgit.h b/cgit.h
index f28cf30..a474d77 100644
--- a/cgit.h
+++ b/cgit.h
@@ -200,6 +200,7 @@ struct cgit_config {
200 int cache_root_ttl; 200 int cache_root_ttl;
201 int cache_scanrc_ttl; 201 int cache_scanrc_ttl;
202 int cache_static_ttl; 202 int cache_static_ttl;
203 int cache_about_ttl;
203 int case_sensitive_sort; 204 int case_sensitive_sort;
204 int embedded; 205 int embedded;
205 int enable_filter_overrides; 206 int enable_filter_overrides;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index b4603ef..9d0c089 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -50,32 +50,40 @@ cache-root::
50 Path used to store the cgit cache entries. Default value: 50 Path used to store the cgit cache entries. Default value:
51 "/var/cache/cgit". See also: "MACRO EXPANSION". 51 "/var/cache/cgit". See also: "MACRO EXPANSION".
52 52
53cache-static-ttl::
54 Number which specifies the time-to-live, in minutes, for the cached
55 version of repository pages accessed with a fixed SHA1. Negative
56 values have infinite ttl. Default value: -1".
57
53cache-dynamic-ttl:: 58cache-dynamic-ttl::
54 Number which specifies the time-to-live, in minutes, for the cached 59 Number which specifies the time-to-live, in minutes, for the cached
55 version of repository pages accessed without a fixed SHA1. Default 60 version of repository pages accessed without a fixed SHA1. Negative
56 value: "5". 61 values have infinite ttl. Default value: "5".
57 62
58cache-repo-ttl:: 63cache-repo-ttl::
59 Number which specifies the time-to-live, in minutes, for the cached 64 Number which specifies the time-to-live, in minutes, for the cached
60 version of the repository summary page. Default value: "5". 65 version of the repository summary page. Negative values have infinite
66 ttl. Default value: "5".
61 67
62cache-root-ttl:: 68cache-root-ttl::
63 Number which specifies the time-to-live, in minutes, for the cached 69 Number which specifies the time-to-live, in minutes, for the cached
64 version of the repository index page. Default value: "5". 70 version of the repository index page. Negative values have infinite
71 ttl. Default value: "5".
65 72
66cache-scanrc-ttl:: 73cache-scanrc-ttl::
67 Number which specifies the time-to-live, in minutes, for the result 74 Number which specifies the time-to-live, in minutes, for the result
68 of scanning a path for git repositories. Default value: "15". 75 of scanning a path for git repositories. Negative values have infinite
76 ttl. Default value: "15".
77
78cache-about-ttl::
79 Number which specifies the time-to-live, in minutes, for the cached
80 version of the repository about page. Negative values have infinite
81 ttl. Default value: "15".
69 82
70cache-size:: 83cache-size::
71 The maximum number of entries in the cgit cache. Default value: "0" 84 The maximum number of entries in the cgit cache. Default value: "0"
72 (i.e. caching is disabled). 85 (i.e. caching is disabled).
73 86
74cache-static-ttl::
75 Number which specifies the time-to-live, in minutes, for the cached
76 version of repository pages accessed with a fixed SHA1. Default value:
77 "5".
78
79case-sensitive-sort:: 87case-sensitive-sort::
80 Sort items in the repo list case sensitively. Default value: "1". 88 Sort items in the repo list case sensitively. Default value: "1".
81 See also: repository-sort, section-sort. 89 See also: repository-sort, section-sort.