Skip to main content
`Ctrl`+`K`

# 7.26.1.4. `grn_cache`

## 7.26.1.4.1. Summary

Note

This API is experimental.

`grn_cache` is a data store that keeps responses of select command. It is not general use cache object. It is only for select command.

You can just change the current cache object by `grn_cache_current_set()`. select command response cache is done internally.

select command uses one global cache object. If you open multiple databases, the one cache is shared. It is an important problem.

If you open multiple databases and use select command, you need to use `grn_cache` object. It is groonga-httpd case. If you open only one database or don’t use select command, you don’t need to use `grn_cache` object. It is rroonga case.

## 7.26.1.4.2. Example

Here is an example that change the current cache object.

    grn_cache *cache;
    grn_cache *cache_previous;
    cache = grn_cache_open(ctx);
    cache_previous = grn_cache_current_get(ctx);
    grn_cache_current_set(ctx, cache);
    /* grn_ctx_send(ctx, ...); */
    grn_cache_current_set(ctx, cache_previous);

## 7.26.1.4.3. Reference

Note

We are currently switching to automatic generation using Doxygen.