Module: Groonga::DefaultCache

Defined in:
ext/groonga/rb-grn-default-cache.c,
ext/groonga/rb-grn-default-cache.c

Overview

This module provides the default cache related features.

Since:

  • 7.0.2

Class Method Summary collapse

Class Method Details

.base_pathString?

Returns the default cache base path or nil.

Returns:

  • (String, nil)

    the default cache base path or nil.

Since:

  • 7.0.2



35
36
37
38
39
40
41
42
43
44
45
46
# File 'ext/groonga/rb-grn-default-cache.c', line 35

static VALUE
rb_grn_default_cache_s_get_base_path (VALUE klass)
{
    const char *base_path;

    base_path = grn_get_default_cache_base_path();
    if (base_path) {
        return rb_str_new_cstr(base_path);
    } else {
        return Qnil;
    }
}

.base_path=(base_path) ⇒ String?

Returns The base_path itself.

Parameters:

  • base_path (String, nil)

    The new default cache base path. If you specify String, the default cache will be persistent. If you specify nil, the default cache will be just on memory. You need to call reopen to apply this change.

Returns:

  • (String, nil)

    The base_path itself.

Since:

  • 7.0.2



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'ext/groonga/rb-grn-default-cache.c', line 58

static VALUE
rb_grn_default_cache_s_set_base_path (VALUE klass, VALUE rb_base_path)
{
    if (NIL_P(rb_base_path)) {
        grn_set_default_cache_base_path(NULL);
    } else {
        const char *base_path;
        base_path = StringValueCStr(rb_base_path);
        grn_set_default_cache_base_path(base_path);
    }

    return rb_base_path;
}

.reopenvoid

This method returns an undefined value.

Reopens the default cache.

Since:

  • 7.0.2



80
81
82
83
84
85
86
87
88
89
# File 'ext/groonga/rb-grn-default-cache.c', line 80

static VALUE
rb_grn_default_cache_s_reopen (VALUE klass)
{
    grn_rc rc;

    rc = grn_cache_default_reopen();
    rb_grn_rc_check(rc, klass);

    return Qnil;
}