summaryrefslogtreecommitdiffstats
path: root/modules/README.rst
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2017-09-01 17:40:36 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2017-09-01 18:22:28 +0200
commit0ba52cca3a59a6315bd1e7e227f3e45425f8c99b (patch)
tree3b6250589d250eaa449a3262cf3d5ded7898f5aa /modules/README.rst
parentcache: rework reusing transactions (LMDB) (diff)
downloadknot-resolver-0ba52cca3a59a6315bd1e7e227f3e45425f8c99b.tar.xz
knot-resolver-0ba52cca3a59a6315bd1e7e227f3e45425f8c99b.zip
docs: purge long-dead cache API from an example
Diffstat (limited to 'modules/README.rst')
-rw-r--r--modules/README.rst17
1 files changed, 4 insertions, 13 deletions
diff --git a/modules/README.rst b/modules/README.rst
index 6d988bd0..4424871e 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