diff options
| author | Stefan Metzmacher <metze@samba.org> | 2014-07-17 12:58:34 +0200 |
|---|---|---|
| committer | Stefan Metzmacher <metze@samba.org> | 2014-07-18 15:43:33 +0200 |
| commit | 45807028d478c082fef6f3a3d5a142d96d63fb50 (patch) | |
| tree | 5f98a560c6b1115ae9a118eb42ea9147080dbe9f /source3/include | |
| parent | b560fac7f78b761ee279d8e87a749125665eb5d1 (diff) | |
| download | samba-45807028d478c082fef6f3a3d5a142d96d63fb50.tar.gz samba-45807028d478c082fef6f3a3d5a142d96d63fb50.tar.xz samba-45807028d478c082fef6f3a3d5a142d96d63fb50.zip | |
lib/util: move memcache.[ch] to the toplevel 'samba-util' library
This is generic enough that it could be used in all code.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 18 15:43:33 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/include')
| -rw-r--r-- | source3/include/memcache.h | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/source3/include/memcache.h b/source3/include/memcache.h deleted file mode 100644 index 97490b963c..0000000000 --- a/source3/include/memcache.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - Unix SMB/CIFS implementation. - In-memory cache - Copyright (C) Volker Lendecke 2007-2008 - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __MEMCACHE_H__ -#define __MEMCACHE_H__ - -struct memcache; - -/* - * A memcache can store different subkeys with overlapping keys, the - * memcache_number becomes part of the key. Feel free to add caches of your - * own here. - * - * If you add talloc type caches, also note this in the switch statement in - * memcache_is_talloc(). - */ - -enum memcache_number { - STAT_CACHE, - GENCACHE_RAM, - GETWD_CACHE, - GETPWNAM_CACHE, /* talloc */ - MANGLE_HASH2_CACHE, - PDB_GETPWSID_CACHE, /* talloc */ - SINGLETON_CACHE_TALLOC, /* talloc */ - SINGLETON_CACHE, - SMB1_SEARCH_OFFSET_MAP -}; - -/* - * Create a memcache structure. max_size is in bytes, if you set it 0 it will - * not forget anything. - */ - -struct memcache *memcache_init(TALLOC_CTX *mem_ctx, size_t max_size); - -/* - * If you set this global memcache, use it as the default cache when NULL is - * passed to the memcache functions below. This is a workaround for many - * situations where passing the cache everywhere would be a big hassle. - */ - -void memcache_set_global(struct memcache *cache); - -/* - * Add a data blob to the cache - */ - -void memcache_add(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB value); - -/* - * Add a talloc object to the cache. The difference to memcache_add() is that - * when the objects is to be discared, talloc_free is called for it. Also - * talloc_move() ownership of the object to the cache. - * - * Please note that the current implementation has a fixed relationship - * between what cache subtypes store talloc objects and which ones store plain - * blobs. We can fix this, but for now we don't have a mixed use of blobs vs - * talloc objects in the cache types. - */ - -void memcache_add_talloc(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, void *ptr); - -/* - * Delete an object from the cache - */ - -void memcache_delete(struct memcache *cache, enum memcache_number n, - DATA_BLOB key); - -/* - * Look up an object from the cache. Memory still belongs to the cache, so - * make a copy of it if needed. - */ - -bool memcache_lookup(struct memcache *cache, enum memcache_number n, - DATA_BLOB key, DATA_BLOB *value); - -/* - * Look up an object from the cache. Memory still belongs to the cache, so - * make a copy of it if needed. - */ - -void *memcache_lookup_talloc(struct memcache *cache, enum memcache_number n, - DATA_BLOB key); - -/* - * Flush a complete cache subset. - */ - -void memcache_flush(struct memcache *cache, enum memcache_number n); - -#endif |
