From: Vladimír Čunát Date: Fri, 1 Sep 2017 15:40:36 +0000 (+0200) Subject: docs: purge long-dead cache API from an example X-Git-Tag: v1.4.0~9^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ba52cca3a59a6315bd1e7e227f3e45425f8c99b;p=thirdparty%2Fknot-resolver.git docs: purge long-dead cache API from an example --- diff --git a/modules/README.rst b/modules/README.rst index 6d988bd0b..4424871ed 100644 --- a/modules/README.rst +++ b/modules/README.rst @@ -279,20 +279,11 @@ Here's an example how a module can expose its property: { /* Get cache from engine. */ struct engine *engine = env; - namedb_t *cache = engine->resolver.cache; - - /* Open read transaction */ - struct kr_cache_txn txn; - int ret = kr_cache_txn_begin(cache, &txn, NAMEDB_RDONLY); - if (ret != 0) { - return NULL; - } - + struct kr_cache *cache = &engine->resolver.cache; /* Read item count */ + int count = (cache->api)->count(cache->db); char *result = NULL; - const namedb_api_t *api = kr_cache_storage(); - asprintf(&result, "{ \"result\": %d }", api->count(&txn)); - kr_cache_txn_abort(&txn); + asprintf(&result, "{ \"result\": %d }", count); return result; } @@ -332,4 +323,4 @@ regular tables. .. _`not present in Go`: http://blog.golang.org/gos-declaration-syntax .. _CGO: http://golang.org/cmd/cgo/ -.. |---| unicode:: U+02014 .. em dash \ No newline at end of file +.. |---| unicode:: U+02014 .. em dash