| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
.. highlight:: c |
| 4 |
|
| 5 |
``grn_cache`` |
| 6 |
============= |
| 7 |
|
| 8 |
Summary |
| 9 |
------- |
| 10 |
|
| 11 |
.. note:: |
| 12 |
|
| 13 |
This API is experimental. |
| 14 |
|
| 15 |
``grn_cache`` is a data store that keeps responses of |
| 16 |
:doc:`/reference/commands/select` command. It is not general use cache |
| 17 |
object. It is only for :doc:`/reference/commands/select` command. |
| 18 |
|
| 19 |
You can just change the current cache object by |
| 20 |
:c:func:`grn_cache_current_set()`. :doc:`/reference/commands/select` |
| 21 |
command response cache is done internally. |
| 22 |
|
| 23 |
:doc:`/reference/commands/select` command uses one global cache |
| 24 |
object. If you open multiple databases, the one cache is shared. It is |
| 25 |
an important problem. |
| 26 |
|
| 27 |
If you open multiple databases and use |
| 28 |
:doc:`/reference/commands/select` command, you need to use |
| 29 |
``grn_cache`` object. It is :doc:`/reference/executables/groonga-httpd` |
| 30 |
case. If you open only one database or don't use |
| 31 |
:doc:`/reference/commands/select` command, you don't need to use |
| 32 |
``grn_cache`` object. It is `rroonga |
| 33 |
<http://ranguba.org/#about-rroonga>`_ case. |
| 34 |
|
| 35 |
Example |
| 36 |
------- |
| 37 |
|
| 38 |
Here is an example that change the current cache object. |
| 39 |
|
| 40 |
.. code-block:: c |
| 41 |
|
| 42 |
grn_cache *cache; |
| 43 |
grn_cache *cache_previous; |
| 44 |
cache = grn_cache_open(ctx); |
| 45 |
cache_previous = grn_cache_current_get(ctx); |
| 46 |
grn_cache_current_set(ctx, cache); |
| 47 |
/* grn_ctx_send(ctx, ...); */ |
| 48 |
grn_cache_current_set(ctx, cache_previous); |
| 49 |
|
| 50 |
|
| 51 |
Reference |
| 52 |
--------- |
| 53 |
|
| 54 |
.. note:: |
| 55 |
We are currently switching to automatic generation using Doxygen. |