summaryrefslogtreecommitdiffabout
path: root/cache.c
authorLars Hjemli <hjemli@gmail.com>2006-12-10 21:41:14 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2006-12-10 21:41:14 (UTC)
commit7640d90b73c01b16bb04ce4c541f52cbaae5f82a (patch) (unidiff)
treea0ec3e5222dbb0cff965487def39f5781e5cb231 /cache.c
parent25105d7ecaba474d4b7c364ebb586aac3dfc5abb (diff)
downloadcgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.zip
cgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.tar.gz
cgit-7640d90b73c01b16bb04ce4c541f52cbaae5f82a.tar.bz2
Add license file and copyright notices
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cache.c') (more/less context) (show whitespace changes)
-rw-r--r--cache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cache.c b/cache.c
index 1be1ea4..b034c48 100644
--- a/cache.c
+++ b/cache.c
@@ -1,24 +1,32 @@
1/* cache.c: cache management
2 *
3 * Copyright (C) 2006 Lars Hjemli
4 *
5 * Licensed under GNU General Public License v2
6 * (see COPYING for full license text)
7 */
8
1#include "cgit.h" 9#include "cgit.h"
2 10
3const int NOLOCK = -1; 11const int NOLOCK = -1;
4 12
5int cache_lookup(struct cacheitem *item) 13int cache_lookup(struct cacheitem *item)
6{ 14{
7 if (!cgit_query_repo) { 15 if (!cgit_query_repo) {
8 item->name = xstrdup(fmt("%s/index.html", cgit_cache_root)); 16 item->name = xstrdup(fmt("%s/index.html", cgit_cache_root));
9 item->ttl = cgit_cache_root_ttl; 17 item->ttl = cgit_cache_root_ttl;
10 } else if (!cgit_query_page) { 18 } else if (!cgit_query_page) {
11 item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root, 19 item->name = xstrdup(fmt("%s/%s/index.html", cgit_cache_root,
12 cgit_query_repo)); 20 cgit_query_repo));
13 item->ttl = cgit_cache_repo_ttl; 21 item->ttl = cgit_cache_repo_ttl;
14 } else { 22 } else {
15 item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root, 23 item->name = xstrdup(fmt("%s/%s/%s/%s.html", cgit_cache_root,
16 cgit_query_repo, cgit_query_page, 24 cgit_query_repo, cgit_query_page,
17 cgit_querystring)); 25 cgit_querystring));
18 if (cgit_query_has_symref) 26 if (cgit_query_has_symref)
19 item->ttl = cgit_cache_dynamic_ttl; 27 item->ttl = cgit_cache_dynamic_ttl;
20 else if (cgit_query_has_sha1) 28 else if (cgit_query_has_sha1)
21 item->ttl = cgit_cache_static_ttl; 29 item->ttl = cgit_cache_static_ttl;
22 else 30 else
23 item->ttl = cgit_cache_repo_ttl; 31 item->ttl = cgit_cache_repo_ttl;
24 } 32 }