Skip to content

Commit

Permalink
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/main/java/org/jruby/ext/jruby/JRubyUtilLibrary.java
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@
import org.jruby.Ruby;
import org.jruby.RubyArray;
import org.jruby.RubyBoolean;
import org.jruby.RubyHash;
import org.jruby.RubyModule;
import org.jruby.RubyString;
import org.jruby.anno.JRubyMethod;
@@ -101,6 +102,17 @@ public static IRubyObject getClassLoaderResources(IRubyObject recv, IRubyObject
return runtime.newEmptyArray();
}

@JRubyMethod(name = "cache_stats", module = true)
public static IRubyObject cache_stats(ThreadContext context, IRubyObject self) {
Ruby runtime = context.runtime;

RubyHash stat = RubyHash.newHash(runtime);
stat.op_aset(context, runtime.newSymbol("method_invalidation_count"), runtime.newFixnum(runtime.getCaches().getMethodInvalidationCount()));
stat.op_aset(context, runtime.newSymbol("constant_invalidation_count"), runtime.newFixnum(runtime.getCaches().getConstantInvalidationCount()));

return stat;
}

public static class StringUtils {
@JRubyMethod
public static IRubyObject unseeded_hash(ThreadContext context, IRubyObject recv) {

0 comments on commit 4a4afa7

Please sign in to comment.