org.jruby.Ruby.getCaches()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(84)

本文整理了Java中org.jruby.Ruby.getCaches方法的一些代码示例,展示了Ruby.getCaches的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getCaches方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getCaches

Ruby.getCaches介绍

[英]Get the Caches management object.
[中]获取缓存管理对象。

代码示例

代码示例来源:origin: org.jruby/jruby-core

public static Invalidator newConstantInvalidator(Ruby runtime) {
  return new ConstantInvalidator(runtime.getCaches());
}

代码示例来源:origin: org.jruby/jruby-complete

public static Invalidator newConstantInvalidator(Ruby runtime) {
  return new ConstantInvalidator(runtime.getCaches());
}

代码示例来源:origin: org.jruby/jruby-complete

public void invalidateCacheDescendants() {
  LOG.debug("{} invalidating descendants", baseName);
  getRuntime().getCaches().incrementMethodInvalidations();
  if (includingHierarchies.isEmpty()) {
    // it's only us; just invalidate directly
    methodInvalidator.invalidate();
    return;
  }
  List<Invalidator> invalidators = new ArrayList<Invalidator>();
  invalidators.add(methodInvalidator);
  synchronized (getRuntime().getHierarchyLock()) {
    for (RubyClass includingHierarchy : includingHierarchies) {
      includingHierarchy.addInvalidatorsAndFlush(invalidators);
    }
  }
  methodInvalidator.invalidateAll(invalidators);
}

代码示例来源:origin: org.jruby/jruby-core

public void invalidateCacheDescendants() {
  LOG.debug("{} invalidating descendants", baseName);
  getRuntime().getCaches().incrementMethodInvalidations();
  if (includingHierarchies.isEmpty()) {
    // it's only us; just invalidate directly
    methodInvalidator.invalidate();
    return;
  }
  List<Invalidator> invalidators = new ArrayList<Invalidator>();
  invalidators.add(methodInvalidator);
  synchronized (getRuntime().getHierarchyLock()) {
    for (RubyClass includingHierarchy : includingHierarchies) {
      includingHierarchy.addInvalidatorsAndFlush(invalidators);
    }
  }
  methodInvalidator.invalidateAll(invalidators);
}

代码示例来源:origin: org.jruby/jruby-complete

/**
 * Provide stats on how many method and constant invalidations have occurred globally.
 *
 * This was added for Pry in https://github.com/jruby/jruby/issues/4384
 */
@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;
}

代码示例来源:origin: org.jruby/jruby-core

/**
 * Provide stats on how many method and constant invalidations have occurred globally.
 *
 * This was added for Pry in https://github.com/jruby/jruby/issues/4384
 */
@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;
}

相关文章

微信公众号

最新文章

更多

Ruby类方法