org.jruby.runtime
Class CacheMap
java.lang.Object
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.
Method Summary |
void |
add(DynamicMethod method,
RubyModule module)
Add another class to the list of classes which are caching the method. |
void |
remove(java.lang.String name,
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 |
CacheMap
public CacheMap(Ruby runtime)
add
public void add(DynamicMethod method,
RubyModule module)
- Add another class to the list of classes which are caching the method.
- Parameters:
method
- which is cachedmodule
- which is caching method
remove
public void remove(java.lang.String name,
DynamicMethod method)
- Remove all method caches associated with the provided method. This signature
relies on having the methods valid name passed with it since the caching classes
store the cache by name.
- Parameters:
name
- of the method to removemethod
- to remove all caches of
Copyright © 2002-2007 JRuby Team. All Rights Reserved.