Class: CacheStats

Inherits:
Object
  • Object
show all
Defined in:
ext/cache_stats/cache_stats.c

Instance Method Summary collapse

Instance Method Details

#[](index) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'ext/cache_stats/cache_stats.c', line 32

static VALUE cache_stats_index(VALUE self, VALUE index)
{
  long i = NUM2LONG(index);
  cache_stats_t *stats;
  Data_Get_Struct(self, cache_stats_t, stats);
  if (i >= stats->num_values || i < 0)
    return Qnil;
  return (stats->bitmap[i / 8] & (1 << (i % 8))) ? Qtrue : Qfalse;
}

#cached_pagesObject



49
50
51
52
53
54
# File 'ext/cache_stats/cache_stats.c', line 49

static VALUE cache_stats_cached_pages(VALUE self)
{
  cache_stats_t *stats;
  Data_Get_Struct(self, cache_stats_t, stats);
  return LONG2NUM(stats->num_set_values);
}

#total_pagesObject



42
43
44
45
46
47
# File 'ext/cache_stats/cache_stats.c', line 42

static VALUE cache_stats_total_pages(VALUE self)
{
  cache_stats_t *stats;
  Data_Get_Struct(self, cache_stats_t, stats);
  return LONG2NUM(stats->num_values);
}