annotate src/filecache.h @ 873:bd3bdceb1230

Optimize file_cache_get() by only moving element to front if needed (most of the time there is no need). Reduce code redundancy in file_cache_put() by calling file_cache_get(). Enhance debugging code.
author zas_
date Wed, 02 Jul 2008 08:38:47 +0000
parents 77fc0ea3457d
children 1646720364cf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
844
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
1 /*
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
2 * Geeqie
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
3 * Copyright (C) 2008 The Geeqie Team
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
4 *
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
5 * Author: Vladimir Nadvornik
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
6 *
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
8 * Please read the included file COPYING for more information.
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
9 * This software comes with no warranty of any kind, use at your own risk!
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
10 */
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
11
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
12 #ifndef FILECACHE_H
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
13 #define FILECACHE_H
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
14
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
15 #include "main.h"
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
16 #include "filedata.h"
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
17
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
18 typedef struct _FileCacheData FileCacheData;
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
19 typedef void (*FileCacheReleaseFunc)(FileData *fd);
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
20
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
21
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
22 FileCacheData *file_cache_new(FileCacheReleaseFunc release, gulong max_size);
873
bd3bdceb1230 Optimize file_cache_get() by only moving element to front if needed
zas_
parents: 847
diff changeset
23 gboolean file_cache_get(FileCacheData *fc, FileData *fd);
844
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
24 void file_cache_put(FileCacheData *fc, FileData *fd, gulong size);
846
8911a4f0e56c simple cache for loaded pixbufs
nadvornik
parents: 844
diff changeset
25 void file_cache_dump(FileCacheData *fc);
847
77fc0ea3457d measure pixbuf cache size in bytes
nadvornik
parents: 846
diff changeset
26 void file_cache_set_size(FileCacheData *fc, gulong size);
77fc0ea3457d measure pixbuf cache size in bytes
nadvornik
parents: 846
diff changeset
27 gulong file_cache_get_max_size(FileCacheData *fc);
77fc0ea3457d measure pixbuf cache size in bytes
nadvornik
parents: 846
diff changeset
28 gulong file_cache_get_size(FileCacheData *fc);
77fc0ea3457d measure pixbuf cache size in bytes
nadvornik
parents: 846
diff changeset
29 void file_cache_set_max_size(FileCacheData *fc, gulong size);
77fc0ea3457d measure pixbuf cache size in bytes
nadvornik
parents: 846
diff changeset
30
844
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
31
efed9a1520d6 implemented generic FileData cache
nadvornik
parents:
diff changeset
32 #endif