]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
docs: purge long-dead cache API from an example
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 1 Sep 2017 15:40:36 +0000 (17:40 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 1 Sep 2017 16:22:28 +0000 (18:22 +0200)
modules/README.rst

index 6d988bd0baa9d5387fb8549d41ffcdad11977f94..4424871ed7a955d771f268aa6e8306b3d09fb36a 100644 (file)
@@ -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