<feed xmlns='http://www.w3.org/2005/Atom'>
<title>cgit/cache.c, branch v0.8</title>
<subtitle>A hyperfast web frontend for git repositories written in C.</subtitle>
<id>http://git.cetero.st/cgit/atom/cache.c?h=v0.8</id>
<link rel='self' href='http://git.cetero.st/cgit/atom/cache.c?h=v0.8'/>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/'/>
<updated>2008-09-01T20:39:00Z</updated>
<entry>
<title>cache.c: use %zd for off_t argument</title>
<updated>2008-09-01T20:39:00Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-08-10T07:24:24Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=2cecf839a06ce951db0d5d95abf79004eff33ca7'/>
<id>urn:sha1:2cecf839a06ce951db0d5d95abf79004eff33ca7</id>
<content type='text'>
Signed-off-by: Lars Hjemli &lt;hjemli@gmail&gt;
</content>
</entry>
<entry>
<title>cache.c: fix error checking in print_slot()</title>
<updated>2008-05-20T15:56:47Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-05-20T15:56:47Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=dd7c172542440170b5b1aca8be43d2ad6dae7227'/>
<id>urn:sha1:dd7c172542440170b5b1aca8be43d2ad6dae7227</id>
<content type='text'>
The change to print_slot() in cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8 made
the function return correct errno for read errors while ignoring write errors,
which is not what was intended. This patch tries to rectify things.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>cache.c: do not ignore errors from print_slot()</title>
<updated>2008-05-18T21:59:11Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-05-18T21:59:11Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=af2e75616d1bfb7dc79d299d10ae0bd39bef47bc'/>
<id>urn:sha1:af2e75616d1bfb7dc79d299d10ae0bd39bef47bc</id>
<content type='text'>
If print_slot() fails, the client will be served an inferior response.
This patch makes sure that such an error will be returned to main(), which
in turn will try to inform about the error in the response itself.

The error is also printed to the cache_log, i.e. stderr, which will make
the error message appear in error_log (atleast when httpd==apache).

Noticed-by: Jim Meyering &lt;jim@meyering.net&gt;
Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>cache.c: use xread()/xwrite() from libgit</title>
<updated>2008-05-18T21:34:55Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-05-18T21:26:05Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8'/>
<id>urn:sha1:cdc6b2f8e7a8d43dcfe0475a9d3498333ea686b8</id>
<content type='text'>
These functions handles EINTR/EAGAIN errors during read/write operations,
which is something cache.c didn't.

While at it, fix a bug in print_slot() where errors during reading from the
cache slot might go by unnoticed.

Noticed-by: Jim Meyering &lt;jim@meyering.net&gt;
Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>cache.c: make all io-related functions return errno on error</title>
<updated>2008-05-18T21:16:50Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-05-18T21:16:50Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=d402811bd2db21c7868411a279fd2d220f54c294'/>
<id>urn:sha1:d402811bd2db21c7868411a279fd2d220f54c294</id>
<content type='text'>
We'll need proper return-values from these functions to make the cache
behave correctly (which includes giving proper error messages).

Noticed-by: Jim Meyering &lt;jim@meyering.net&gt;
Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>cache.c: read(2) returns -1 on error, not 0</title>
<updated>2008-05-18T21:10:05Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-05-18T21:10:05Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=6102bcfce46fd357566941d565b95f78510af79b'/>
<id>urn:sha1:6102bcfce46fd357566941d565b95f78510af79b</id>
<content type='text'>
Noticed-by: Jim Meyering &lt;jim@meyering.net&gt;
Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Add page 'ls_cache'</title>
<updated>2008-04-28T10:10:13Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-04-28T10:10:13Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=9000bbf865cb3578ba5ed3810dc44253cb46ec7f'/>
<id>urn:sha1:9000bbf865cb3578ba5ed3810dc44253cb46ec7f</id>
<content type='text'>
This new page will list all entries found in the current cache, which is
useful when reviewing the new cache implementation. There are no links to
the new page, but it's reachable by adding 'p=ls_cache' to any cgit url.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Redesign the caching layer</title>
<updated>2008-04-28T09:32:42Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-04-28T09:32:42Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=939d32fda70ea66c9db51687beb3cea6da7b0599'/>
<id>urn:sha1:939d32fda70ea66c9db51687beb3cea6da7b0599</id>
<content type='text'>
The original caching layer in cgit has no upper bound on the number of
concurrent cache entries, so when cgit is traversed by a spider (like the
googlebot), the cache might end up filling your disk. Also, if any error
occurs in the cache layer, no content is returned to the client.

This patch redesigns the caching layer to avoid these flaws by
* giving the cache a bound number of slots
* disabling the cache for the current request when errors occur

The cache size limit is implemented by hashing the querystring (the cache
lookup key) and generating a cache filename based on this hash modulo the
cache size. In order to detect hash collisions, the full lookup key (i.e.
the querystring) is stored in the cache file (separated from its associated
content by ascii 0).

The cache filename is the reversed 8-digit hexadecimal representation of

  hash(key) % cache_size

which should make the filesystem lookup pretty fast (if directory content
is indexed/sorted); reversing the representation avoids the problem where
all keys have equal prefix.

There is a new config option, cache-size, which sets the upper bound for
the cache. Default value for this option is 0, which has the same effect
as setting nocache=1 (hence nocache is now deprecated).

Included in this patch is also a new testfile which verifies that the
new option works as intended.

Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Add cache.h</title>
<updated>2008-03-27T08:22:13Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-03-27T08:22:13Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=ee4056bd2c902a12dea67874368863fe60ea5a5f'/>
<id>urn:sha1:ee4056bd2c902a12dea67874368863fe60ea5a5f</id>
<content type='text'>
The functions found in cache.c are only used by cgit.c, so there's no
point in rebuilding all object files when the cache interface is changed.


Signed-off-by: Lars Hjemli &lt;hjemli@gmail.com&gt;
</content>
</entry>
<entry>
<title>Move cgit_repo into cgit_context</title>
<updated>2008-02-16T12:56:09Z</updated>
<author>
<name>Lars Hjemli</name>
<email>hjemli@gmail.com</email>
</author>
<published>2008-02-16T12:56:09Z</published>
<link rel='alternate' type='text/html' href='http://git.cetero.st/cgit/commit/?id=d1f3bbe9d22029f45a77bb938c176ccc0c827d46'/>
<id>urn:sha1:d1f3bbe9d22029f45a77bb938c176ccc0c827d46</id>
<content type='text'>
This removes the global variable which is used to keep track of the
currently selected repository, and adds a new variable in the cgit_context
structure.

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