-#if HAVE_LIBMEMCACHED_MEMCACHED_H
- if (r->connection && r->connection->mc_st)
- {
- WRBUF k = wrbuf_alloc();
- size_t v_len;
- char *v_buf;
- uint32_t flags;
- memcached_return_t rc;
-
- wrbuf_write(k, wrbuf_buf(r->mc_key), wrbuf_len(r->mc_key));
- wrbuf_printf(k, ";%d;%s;%s;%s", pos,
- syntax ? syntax : "",
- elementSetName ? elementSetName : "",
- schema ? schema : "");
-
- yaz_log(YLOG_LOG, "Lookup record %s", wrbuf_cstr(k));
- v_buf = memcached_get(r->connection->mc_st, wrbuf_buf(k), wrbuf_len(k),
- &v_len, &flags, &rc);
- wrbuf_destroy(k);
- if (v_buf)
- {
- Z_NamePlusRecord *npr = 0;
-
- odr_setbuf(r->odr, v_buf, v_len, 0);
-
- z_NamePlusRecord(r->odr, &npr, 0, 0);
- free(v_buf);
- if (npr)
- {
- yaz_log(YLOG_LOG, "returned memcached copy");
- return record_cache_add(r, npr, pos, syntax, elementSetName,
- schema, 0);
- }
- yaz_log(YLOG_WARN, "memcached_get npr failed v_len=%ld",
- (long) v_len);
- }
- }
-#endif
+ npr = ZOOM_memcached_lookup(r, pos, syntax, elementSetName, schema);
+ if (npr)
+ return record_cache_add(r, npr, pos, syntax, elementSetName,
+ schema, 0);