cat_memdbflags - change the behaviour of cat_memdb functions.
#include <cat/cat.h>
#include <cat/catutil.h>
int cat_memdbflags(cat_memdb *db, int flags, ...);
This function gets and sets flags for the db memory database. If the
flags argument is negative, the flags are not changed. Flags can be binary
ORed together. The following flags can be set for a cat_memdb:
- CATMEMDB_UPDATE
-
Update the entry timestamp for each hit.
- CATMEMDB_NOCOPY_GET
-
Point directly into the database on GET, rather than copy data. This is not
thread-safe and RSA Security recommends that you avoid this.
- CATMEMDB_NOCOPY_PUT
-
The same as CATMEMDB_NOCOPY_GET above but used when storing data instead. Applies to both key and data.
- CATMEMDB_FREEFUNC
-
Supply a function to free data in an entry. The caller must provide a valid
function pointer as an extra argument. The function should not free the
supplied catdb_data structure. The function should match the following prototype:
typedef void cat_memdbfreefunc(catdb_data *);
- CATMEMDB_NOCASE
-
Makes the database search function case-insensitive.
- CATMEMDB_MAXSIZE
-
Limits the size of the database. If setting this flag, the caller must
provide a size value (in bytes) as an extra argument. When the database was
created, a TTL value must have been specified, using cat_newfildb, for the entries in the database.
The function returns the value of the old flags, or a negative code on
error.
cat, catutil
cat_newmemdb, cat_freememdb, cat_memdbforeach,
cat_memdbfunc