path2 = talloc_strdup(mem_ctx, "/tmp/two");
assert_non_null(path1);
- memcache_add_talloc(cache, GETWD_CACHE, key1, &path1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key1, &path1);
assert_null(path1);
- memcache_add_talloc(cache, GETWD_CACHE, key2, &path2);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key2, &path2);
assert_null(path2);
- path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+ path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
assert_non_null(path1);
assert_string_equal(path1, "/tmp/one");
- path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+ path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
assert_non_null(path2);
assert_string_equal(path2, "/tmp/two");
- memcache_delete(cache, GETWD_CACHE, key1);
- path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+ memcache_delete(cache, SINGLETON_CACHE_TALLOC, key1);
+ path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
assert_null(path1);
- memcache_flush(cache, GETWD_CACHE);
- path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+ memcache_flush(cache, SINGLETON_CACHE_TALLOC);
+ path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
assert_null(path2);
TALLOC_FREE(path1);
path2 = talloc_strdup(mem_ctx, "/tmp/two");
assert_non_null(path1);
- memcache_add_talloc(cache, GETWD_CACHE, key1, &path1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key1, &path1);
assert_null(path1);
- memcache_add_talloc(cache, GETWD_CACHE, key2, &path2);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, key2, &path2);
assert_null(path2);
- path1 = memcache_lookup_talloc(cache, GETWD_CACHE, key1);
+ path1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key1);
assert_null(path1);
- path2 = memcache_lookup_talloc(cache, GETWD_CACHE, key2);
+ path2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, key2);
assert_non_null(path2);
assert_string_equal(path2, "/tmp/two");
TALLOC_FREE(cache);
- /* GETWD_CACHE TESTS */
+ /* SINGLETON_CACHE_TALLOC TESTS */
str1 = talloc_strdup(mem_ctx, "string1");
if (str1 == NULL) {
return false;
return false;
}
- memcache_add_talloc(cache, GETWD_CACHE, k2, &str1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k2, &str1);
/* str1 == NULL now. */
- ptr1 = memcache_lookup_talloc(cache, GETWD_CACHE, k2);
+ ptr1 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k2);
if (ptr1 == NULL) {
printf("could not find k2\n");
return false;
d3 = data_blob_talloc_zero(mem_ctx, 180);
memcache_add(cache, STAT_CACHE, k3, d3);
- ptr2 = memcache_lookup_talloc(cache, GETWD_CACHE, k2);
+ ptr2 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k2);
if (ptr2 != NULL) {
printf("Did find k2, should have been purged\n");
return false;
str1 = talloc_zero_size(mem_ctx, 100);
str2 = talloc_zero_size(mem_ctx, 100);
- memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
- memcache_add_talloc(cache, GETWD_CACHE, k5, &str1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k5, &str1);
- ptr3 = memcache_lookup_talloc(cache, GETWD_CACHE, k4);
+ ptr3 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k4);
if (ptr3 != NULL) {
printf("Did find k4, should have been purged\n");
return false;
* total talloced size.
*/
str1 = talloc_zero_size(mem_ctx, 100);
- memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
/*
* Now overwrite with a small talloced
* value. This should fit in the existing size
* from the cache size.
*/
str1 = talloc_zero_size(mem_ctx, 2);
- memcache_add_talloc(cache, GETWD_CACHE, k4, &str1);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k4, &str1);
/*
* Now store a 20 byte string. If the
* total talloced size wasn't accounted for
* will evict k4.
*/
str2 = talloc_zero_size(mem_ctx, 20);
- memcache_add_talloc(cache, GETWD_CACHE, k5, &str2);
+ memcache_add_talloc(cache, SINGLETON_CACHE_TALLOC, k5, &str2);
- ptr3 = memcache_lookup_talloc(cache, GETWD_CACHE, k4);
+ ptr3 = memcache_lookup_talloc(cache, SINGLETON_CACHE_TALLOC, k4);
if (ptr3 == NULL) {
printf("Did not find k4, should not have been purged\n");
return false;