File: grn_cache.rst

package info (click to toggle)
groonga 16.0.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 188,416 kB
  • sloc: ansic: 772,827; cpp: 52,396; ruby: 40,556; javascript: 10,250; yacc: 7,045; sh: 5,627; python: 2,821; makefile: 1,679
file content (55 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
.. -*- rst -*-

.. highlight:: c

``grn_cache``
=============

Summary
-------

.. note::

   This API is experimental.

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

You can just change the current cache object by
:c:func:`grn_cache_current_set()`. :doc:`/reference/commands/select`
command response cache is done internally.

:doc:`/reference/commands/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
:doc:`/reference/commands/select` command, you need to use
``grn_cache`` object. It is :doc:`/reference/executables/groonga-httpd`
case. If you open only one database or don't use
:doc:`/reference/commands/select` command, you don't need to use
``grn_cache`` object. It is `rroonga
<http://ranguba.org/#about-rroonga>`_ case.

Example
-------

Here is an example that change the current cache object.

.. code-block:: c

   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);


Reference
---------

.. note::
   We are currently switching to automatic generation using Doxygen.