navit  0.5.3-trunk
cache.c File Reference
#include "glib_slice.h"
#include <string.h>
#include "debug.h"
#include "cache.h"

Data Structures

struct  cache_entry
 
struct  cache_entry_list
 
struct  cache
 

Functions

static void cache_entry_dump (struct cache *cache, struct cache_entry *entry)
 
static void cache_list_dump (char *str, struct cache *cache, struct cache_entry_list *list)
 
static guint cache_hash4 (gconstpointer key)
 
static guint cache_hash20 (gconstpointer key)
 
static gboolean cache_equal4 (gconstpointer a, gconstpointer b)
 
static gboolean cache_equal20 (gconstpointer a, gconstpointer b)
 
struct cachecache_new (int id_size, int size)
 
void cache_resize (struct cache *cache, int size)
 
static void cache_insert_mru (struct cache *cache, struct cache_entry_list *list, struct cache_entry *entry)
 
static void cache_remove_from_list (struct cache_entry_list *list, struct cache_entry *entry)
 
static void cache_remove (struct cache *cache, struct cache_entry *entry)
 
static struct cache_entrycache_remove_lru_helper (struct cache_entry_list *list)
 
static struct cache_entrycache_remove_lru (struct cache *cache, struct cache_entry_list *list)
 
void * cache_entry_new (struct cache *cache, void *id, int size)
 
void cache_entry_destroy (struct cache *cache, void *data)
 
static struct cache_entrycache_trim (struct cache *cache, struct cache_entry *entry)
 
static struct cache_entrycache_move (struct cache *cache, struct cache_entry_list *old, struct cache_entry_list *new)
 
static int cache_replace (struct cache *cache)
 
void cache_flush (struct cache *cache, void *id)
 
void cache_flush_data (struct cache *cache, void *data)
 
void * cache_lookup (struct cache *cache, void *id)
 
void cache_insert (struct cache *cache, void *data)
 
void * cache_insert_new (struct cache *cache, void *id, int size)
 
static void cache_stats (struct cache *cache)
 
void cache_dump (struct cache *cache)
 

Function Documentation

◆ cache_dump()

void cache_dump ( struct cache cache)

References cache_list_dump(), cache_stats(), dbg, and lvl_debug.

Referenced by cache_replace().

◆ cache_entry_destroy()

void cache_entry_destroy ( struct cache cache,
void *  data 
)

◆ cache_entry_dump()

static void cache_entry_dump ( struct cache cache,
struct cache_entry entry 
)
static

◆ cache_entry_new()

void* cache_entry_new ( struct cache cache,
void *  id,
int  size 
)

◆ cache_equal20()

static gboolean cache_equal20 ( gconstpointer  a,
gconstpointer  b 
)
static

Referenced by cache_new().

◆ cache_equal4()

static gboolean cache_equal4 ( gconstpointer  a,
gconstpointer  b 
)
static

Referenced by cache_new().

◆ cache_flush()

void cache_flush ( struct cache cache,
void *  id 
)

◆ cache_flush_data()

void cache_flush_data ( struct cache cache,
void *  data 
)

◆ cache_hash20()

static guint cache_hash20 ( gconstpointer  key)
static

References key.

Referenced by cache_new().

◆ cache_hash4()

static guint cache_hash4 ( gconstpointer  key)
static

References key.

Referenced by cache_new().

◆ cache_insert()

void cache_insert ( struct cache cache,
void *  data 
)

◆ cache_insert_mru()

◆ cache_insert_new()

void* cache_insert_new ( struct cache cache,
void *  id,
int  size 
)

◆ cache_list_dump()

static void cache_list_dump ( char *  str,
struct cache cache,
struct cache_entry_list list 
)
static

◆ cache_lookup()

◆ cache_move()

static struct cache_entry* cache_move ( struct cache cache,
struct cache_entry_list old,
struct cache_entry_list new 
)
static

◆ cache_new()

struct cache* cache_new ( int  id_size,
int  size 
)

◆ cache_remove()

static void cache_remove ( struct cache cache,
struct cache_entry entry 
)
static

◆ cache_remove_from_list()

static void cache_remove_from_list ( struct cache_entry_list list,
struct cache_entry entry 
)
static

◆ cache_remove_lru()

◆ cache_remove_lru_helper()

static struct cache_entry* cache_remove_lru_helper ( struct cache_entry_list list)
static

◆ cache_replace()

static int cache_replace ( struct cache cache)
static

◆ cache_resize()

void cache_resize ( struct cache cache,
int  size 
)

References cache::size, and size.

Referenced by file_set_cache_size().

◆ cache_stats()

static void cache_stats ( struct cache cache)
static

◆ cache_trim()

static struct cache_entry* cache_trim ( struct cache cache,
struct cache_entry entry 
)
static