namecache redesign

tridge at samba.org tridge at samba.org
Fri Aug 30 17:00:01 GMT 2002


Tim,

> How about keeping basically the same API in namecache.c (i.e expiry
> based on time_t) but with an appropriate key prefix as you suggest?

What I'd like to see is a lib/gencache.c module that provides a string
based cache. So all cache entries would have string keys and string
values.

key: NBT/name#1c
value: 192.168.2.10 192.168.3.21

then namecache.c would just call routines in gencache.c to provide
convenient wrapper routines that convert to/from "struct in_addr"

I also think we need management tools in net. eg:

  net cache list
  net cache delete NBT/name#1c
  net cache flush

even better if 'net cache delete' could take wildcards (using
fnmatch()). So you can do:

  net cache delete NBT/*

the C API in gencache.c could be:

BOOL gencache_add(const char *key, const char *value, time_t timeout);
BOOL gencache_del(const char *key);
BOOL gencache_get(const char *key, char **value, time_t *timeout);
void gencache_iterate(void (*fn)(const char *key, const char *value, time_t timeout));

plus startup/shutdown functions:

BOOL gencache_startup(void);
BOOL gencache_shutdown(void);

sound ok?

mimir, do you feel like taking this on?



More information about the samba-technical mailing list