Navigation Menu

Skip to content

Commit

Permalink
cache: fix fetch return GRN_SUCCESS for not found case
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 4, 2017
1 parent d4fb073 commit 9914f50
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/cache.c
Expand Up @@ -420,8 +420,15 @@ grn_cache_fetch_persistent(grn_ctx *ctx, grn_cache *cache,
return rc;
}

/* TODO: How about GRN_NOT_FOUND? */
rc = GRN_INVALID_ARGUMENT;

cache->nfetches++;
cache_id = grn_hash_get(cache->ctx, keys, key, key_len, (void **)&entry);
if (cache_id == GRN_ID_NIL) {
goto exit;
}

if (cache_id != GRN_ID_NIL) {
if (entry->modified_time.tv_sec <=
grn_db_get_last_modified(ctx, ctx->impl->db)) {
Expand Down

0 comments on commit 9914f50

Please sign in to comment.