2 * Unix SMB/CIFS implementation.
4 * Generic, persistent and shared between processes cache mechanism for use
5 * by various parts of the Samba code
7 * Copyright (C) Rafal Szczesniak 2002
8 * Copyright (C) Volker Lendecke 2009
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __LIB_GENCACHE_H__
25 #define __LIB_GENCACHE_H__
28 #include "system/time.h"
29 #include "lib/util/data_blob.h"
31 bool gencache_set(const char *keystr
, const char *value
, time_t timeout
);
32 bool gencache_del(const char *keystr
);
33 bool gencache_get(const char *keystr
, TALLOC_CTX
*mem_ctx
, char **value
,
37 * This might look like overkill, but namemap_cache.c shows it's
40 struct gencache_timeout
;
41 bool gencache_timeout_expired(const struct gencache_timeout
*t
);
43 bool gencache_parse(const char *keystr
,
44 void (*parser
)(const struct gencache_timeout
*timeout
,
48 bool gencache_get_data_blob(const char *keystr
, TALLOC_CTX
*mem_ctx
,
50 time_t *timeout
, bool *was_expired
);
51 bool gencache_set_data_blob(const char *keystr
, DATA_BLOB blob
,
53 void gencache_iterate_blobs(void (*fn
)(const char *key
, DATA_BLOB value
,
54 time_t timeout
, void *private_data
),
55 void *private_data
, const char *pattern
);
56 void gencache_iterate(void (*fn
)(const char* key
, const char *value
,
57 time_t timeout
, void* dptr
),
58 void* data
, const char* keystr_pattern
);