org.jruby.runtime
Class CacheMap

java.lang.Object
  extended by org.jruby.runtime.CacheMap

public class CacheMap
extends java.lang.Object

This class represents mappings between methods that have been cached and the classes which have cached them. Methods within RubyModule will update this cacheMap as needed. Here is a list of scenarios when cached methods will become invalid: 1. Redefine a method in a base class 2. Add an alias in a superclass that is the same name as a cached method in a base class 3. Include a module that has a same-named method as one already caches in a base class 4. Remove a method definition 5. Add a same-named method in super class that has been cached in a super class Concurrency is another concern with managing this structure. Rather than synchronize this we are going to rely on synchronization further upstream. RubyModule methods that directly call this is responsible for synchronization.


Nested Class Summary
static interface CacheMap.CacheSite
           
 
Constructor Summary
CacheMap()
           
 
Method Summary
 void add(DynamicMethod method, CacheMap.CacheSite site)
          Add another class to the list of classes which are caching the method.
 void moduleIncluded(RubyModule targetModule, RubyModule includedModule)
          Remove method caches for all methods in a module
 void remove(DynamicMethod method)
          Remove all method caches associated with the provided method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheMap

public CacheMap()
Method Detail

add

public void add(DynamicMethod method,
                CacheMap.CacheSite site)
Add another class to the list of classes which are caching the method.

Parameters:
method - which is cached
module - which is caching method

remove

public void remove(DynamicMethod method)
Remove all method caches associated with the provided method.

Parameters:
method - to remove all caches of

moduleIncluded

public void moduleIncluded(RubyModule targetModule,
                           RubyModule includedModule)
Remove method caches for all methods in a module



Copyright © 2002-2007 JRuby Team. All Rights Reserved.