X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fzoom-z3950.c;h=a16a8091f3a36bc1a0fdc8aac84749c3d0d29693;hp=f2517e044c5e038ed5b6837608a3674865f42a36;hb=32790840d73b1f4a4bde1478e6b14699aac00e94;hpb=30b3c16a904efc6f5e0c4326eaa7e13589921572 diff --git a/src/zoom-z3950.c b/src/zoom-z3950.c index f2517e0..a16a809 100644 --- a/src/zoom-z3950.c +++ b/src/zoom-z3950.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2013 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** @@ -1273,6 +1273,24 @@ static void handle_Z3950_search_response(ZOOM_connection c, handle_facet_result(c, resultset, sr->additionalSearchInfo); resultset->size = *sr->resultCount; + +#if HAVE_LIBMEMCACHED_MEMCACHED_H + if (c->mc_st) + { + uint32_t flags = 0; + memcached_return_t rc; + time_t expiration = 36000; + char str[40]; + + sprintf(str, ODR_INT_PRINTF, *sr->resultCount); + rc = memcached_set(c->mc_st, + wrbuf_buf(resultset->mc_key),wrbuf_len(resultset->mc_key), + str, strlen(str), expiration, flags); + yaz_log(YLOG_LOG, "Key=%s value=%s rc=%u %s", + wrbuf_cstr(resultset->mc_key), str, (unsigned) rc, + memcached_last_error_message(c->mc_st)); + } +#endif handle_Z3950_records(c, sr->records, 0); } @@ -1386,6 +1404,7 @@ static void handle_Z3950_records(ZOOM_connection c, Z_Records *sr, "ZOOM C generated. Present phase and no records"); ZOOM_record_cache_add(resultset, myrec, *start, syntax, elementSetName, schema, 0); + *count = 0; } } else if (present_phase) @@ -1398,6 +1417,7 @@ static void handle_Z3950_records(ZOOM_connection c, Z_Records *sr, "ZOOM C generated: Present response and no records"); ZOOM_record_cache_add(resultset, myrec, *start, syntax, elementSetName, schema, 0); + *count = 0; } } }