Go to the source code of this file.
Detailed Description
Implements generic caching of any pointer identified by a unique key.
API usage:
Definition in file cache.c.
Function Documentation
| int cache_add |
( |
const char * |
key, |
|
|
void * |
ptr, |
|
|
uint32 |
flags |
|
) |
| |
Add an entry to the cache.
- Parameters:
-
| key | Unique identified for the cache entry. |
| ptr | Pointer to store; must not be freed. |
| flags | A combination of Cache flags. |
- Returns:
- 1 on success, 0 on failure (NULL ptr, or cache entry with name 'key' already exists).
Definition at line 119 of file cache.c.
| static int cache_compare |
( |
const void * |
one, |
|
|
const void * |
two |
|
) |
| [static] |
Attempt to find a cache entry, identified by 'key'.
- Parameters:
-
- Returns:
- Pointer to the cache entry, NULL if there is no such entry.
Definition at line 97 of file cache.c.
| int cache_remove |
( |
shstr * |
key | ) |
|
Remove a cache entry identified by 'key'.
- Parameters:
-
| key | What cache entry to remove. |
- Returns:
- 1 on success, 0 on failure (cache entry not found).
Definition at line 164 of file cache.c.
| void cache_remove_all |
( |
| ) |
|
Remove all cache entries.
Definition at line 203 of file cache.c.
| void cache_remove_by_flags |
( |
uint32 |
flags | ) |
|
Remove all cache entries identified by (a combination of) 'flags'.
- Parameters:
-
Definition at line 215 of file cache.c.
Variable Documentation
Array of the cached entries.
Definition at line 59 of file cache.c.