/* * call-seq: * lmc.get(key) -> string value or nil * lmc[key] -> string value or nil * * Retrieve string value from hashtable. */ static VALUE LocalMemCache__get(VALUE obj, VALUE key) { size_t l; lmc_rb_str_d_t k; rstring_acquire(key, &k); const char* r = __local_memcache_get(get_LocalMemCache(obj), k.cstr, k.len, &l); VALUE rr = lmc_ruby_string2(r, l); lmc_unlock_shm_region("local_memcache_get", get_LocalMemCache(obj)); return rr; }
/* * call-seq: * lmc.get(key) -> string value or nil * lmc[key] -> string value or nil * * Retrieve string value from hashtable. */ static mrb_value Cache__get(mrb_state *mrb, mrb_value self) { local_memcache_t *lmc = get_Cache(mrb, self); size_t l; char *key; mrb_int n_key; mrb_get_args(mrb, "s", &key, &n_key); const char *r = __local_memcache_get(lmc, key, n_key, &l); mrb_value rr = lmc_ruby_string2(mrb, r, l); lmc_unlock_shm_region("local_memcache_get", lmc); return rr; }