BRL-CAD
|
Go to the source code of this file.
Data Structures | |
struct | bu_cache |
Functions | |
struct bu_cache * | bu_cache_open (const char *cache_db, int create) |
void | bu_cache_close (struct bu_cache *c) |
void | bu_cache_erase (const char *cache_db) |
size_t | bu_cache_get (void **data, const char *key, struct bu_cache *c) |
void | bu_cache_get_done (const char *key, struct bu_cache *c) |
size_t | bu_cache_write (void **data, const char *key, struct bu_cache *c) |
void | bu_cache_clear (const char *key, struct bu_cache *c) |
Routines for managing and accessing a key/value data store.
Definition in file cache.h.
struct bu_cache* bu_cache_open | ( | const char * | cache_db, |
int | create | ||
) |
Opens the specified cache database from the BRL-CAD BU_DIR_CACHE folder. The cache_db string may contain a hierarchical path, but note that all paths will be interpreted as relative to the BU_DIR_CACHE location - no absolute paths can be specified.
If the create flag is non-zero, bu_cache_open will create the specified cache_db if it does not already exist.
returns the bu_cache structure on success, NULL on failure.
void bu_cache_erase | ( | const char * | cache_db | ) |
Erase the specified cache from disk. Any open instances of the cache should be closed before calling this function.
size_t bu_cache_get | ( | void ** | data, |
const char * | key, | ||
struct bu_cache * | c | ||
) |
Retrieve data (read-only) from the cache using the specified key. User should call bu_cache_get_done once their use of data is complete.
Returns the size of the retrieved data.
void bu_cache_get_done | ( | const char * | key, |
struct bu_cache * | c | ||
) |
Data retrieved using bu_cache_get is temporary - once the user is done either reading it or copying it, libbu needs to be told that the usage of the returned data is complete.
size_t bu_cache_write | ( | void ** | data, |
const char * | key, | ||
struct bu_cache * | c | ||
) |
Assign data to the cache using the specified key
void bu_cache_clear | ( | const char * | key, |
struct bu_cache * | c | ||
) |
Clear data associated with the specified key from the cache