<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cgit/cache.c, branch v0.4</title>
<subtitle>A hyperfast web frontend for git repositories written in C.</subtitle>
<id>https://git.zx2c4.com/cgit/atom/cache.c?h=v0.4</id>
<link rel='self' href='https://git.zx2c4.com/cgit/atom/cache.c?h=v0.4'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/'/>
<updated>2007-01-11T23:24:35Z</updated>
<entry>
<title>Remove troublesome chars from cachefile names</title>
<updated>2007-01-11T23:24:35Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2007-01-11T23:24:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=2c2047ff67a1e0053f95776e5079e432f69cea54'/>
<id>urn:sha1:2c2047ff67a1e0053f95776e5079e432f69cea54</id>
<content type='text'>
Add a funtion cache_safe_filename() which replaces possibly bad filename
characters with '_'.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Move cache_prepare() to cgit</title>
<updated>2007-01-11T23:00:15Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2007-01-11T23:00:15Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=83a5f35a2724ee60bfd8c5679b98da7008272254'/>
<id>urn:sha1:83a5f35a2724ee60bfd8c5679b98da7008272254</id>
<content type='text'>
This moves some cgit-specific stuff away from cache.c

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Allow relative paths for cgit_cache_root</title>
<updated>2006-12-16T12:55:58Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-16T12:55:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=7c849d94ec1cfecdec5a88d49f5af5c98f96ebca'/>
<id>urn:sha1:7c849d94ec1cfecdec5a88d49f5af5c98f96ebca</id>
<content type='text'>
Make sure we chdir(2) back to the original getcwd(2) when a page
has been generated. Also, if the cgit_cache_root do not exist,
try to create it.

This is a feature intended to ease testing/debugging.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>cache_lock: do xstrdup/free on lockfile</title>
<updated>2006-12-12T09:16:41Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-12T09:16:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=58d04f6523b0029281d65f841859fa42d0c744ff'/>
<id>urn:sha1:58d04f6523b0029281d65f841859fa42d0c744ff</id>
<content type='text'>
Since fmt() uses 8 alternating static buffers, and cache_lock might call
cache_create_dirs() multiple times, which in turn might call fmt() twice,
after four iterations lockfile would be overwritten by a cachedirectory
path.

In worst case, this could cause the cachedirectory to be unlinked and replaced
by a cachefile.

Fix: use xstrdup() on the result from fmt() before assigning to lockfile, and
call free(lockfile) before exit.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Don't truncate valid cachefiles</title>
<updated>2006-12-11T21:53:50Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-11T21:53:50Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=fbaf1171b4e343929dd43ecac7cd9d1c692b84ec'/>
<id>urn:sha1:fbaf1171b4e343929dd43ecac7cd9d1c692b84ec</id>
<content type='text'>
An embarrassing thinko in cgit_check_cache() would truncate valid cachefiles
in the following situation:
  1) process A notices a missing/expired cachefile
  2) process B gets scheduled, locks, fills and unlocks the cachefile
  3) process A gets scheduled, locks the cachefile, notices that the cachefile
     now exist/is not expired anymore, and continues to overwrite it with an
     empty lockfile.

Thanks to Linus for noticing (again).

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Avoid infinite loops in caching layer</title>
<updated>2006-12-11T11:10:12Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-11T11:10:12Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=318d106300102c19d114a4ea89265b0a4060d9cb'/>
<id>urn:sha1:318d106300102c19d114a4ea89265b0a4060d9cb</id>
<content type='text'>
Add a global variable, cgit_max_lock_attemps, to avoid the possibility of
infinite loops when failing to acquire a lockfile. This could happen on
broken setups or under crazy server load.

Incidentally, this also fixes a lurking bug in cache_lock() where an
uninitialized returnvalue was used.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Fix cache algorithm loophole</title>
<updated>2006-12-11T08:57:58Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-11T08:57:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=f5069d88dff7a7ed2f4665904b03e906cca75a7c'/>
<id>urn:sha1:f5069d88dff7a7ed2f4665904b03e906cca75a7c</id>
<content type='text'>
This closes the door for unneccessary calls to cgit_fill_cache().

Noticed by Linus.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Add license file and copyright notices</title>
<updated>2006-12-10T21:41:14Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-10T21:41:14Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=7640d90b73c01b16bb04ce4c541f52cbaae5f82a'/>
<id>urn:sha1:7640d90b73c01b16bb04ce4c541f52cbaae5f82a</id>
<content type='text'>
Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Add caching infrastructure</title>
<updated>2006-12-10T21:31:36Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2006-12-10T21:31:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/cgit/commit/?id=25105d7ecaba474d4b7c364ebb586aac3dfc5abb'/>
<id>urn:sha1:25105d7ecaba474d4b7c364ebb586aac3dfc5abb</id>
<content type='text'>
This enables internal caching of page output.

Page requests are split into four groups:
  1) repo listing (front page)
  2) repo summary
  3) repo pages w/symbolic references in query string
  4) repo pages w/constant sha1's in query string

Each group has a TTL specified in minutes. When a page is requested, a cached
filename is stat(2)'ed and st_mtime is compared to time(2). If TTL has expired
(or the file didn't exist), the cached file is regenerated.

When generating a cached file, locking is used to avoid parallell processing
of the request. If multiple processes tries to aquire the same lock, the ones
who fail to get the lock serves the (expired) cached file. If the cached file
don't exist, the process instead calls sched_yield(2) before restarting the
request processing.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
</feed>
