diff options
Diffstat (limited to 'modules/README.rst')
-rw-r--r-- | modules/README.rst | 17 |
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 |