Cache superclass result
543866
def get_children(self):
        """"""
        key = self.CHILDREN_KEY % self.pk
        #children = cache.get(key, None)
        # if children is None:
        children = super(Page, self).get_children()
        #cache.set(key, children)
        return children
321158
private ObjectCache getCachePerClass(Class objectClass, int methodCall)
    {
        ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName());
        if (cache == null && methodCall == AbstractMetaCache.METHOD_CACHE)
        {
            /**
             * the cache wasn't found, and the cachesByClass didn't contain the key with a
             * null value, so create a new cache for this classtype
             */
            cache = new ObjectCacheJCSImpl(objectClass.getName());
            cachesByClass.put(objectClass.getName(), cache);
        }
        return cache;
    }
9239
private void cacheClass(ClassSource classSource, String outerClassName) {
        if (classCacheMode != UserCodeDeploymentConfig.ClassCacheMode.OFF) {
            classSourceMap.put(outerClassName, classSource);
        } else {
            ThreadLocalClassCache.store(outerClassName, classSource);
        }
    }
529865
def get_subclass(cls, name):
        
        for subclass in cls.__subclasses__():
            if subclass.name == name:
                return subclass
        raise NameError("Not a valid Benchmark class: " + name)
1187563
def cached(cls, timeout=60, cache_none=False):
        
        return CachedModel(cls=cls, timeout=timeout, cache_none=cache_none)
532453
public MergingIterator<ZooPC> loadAllInstances(Class<?> cls, 
			boolean subClasses, boolean loadFromCache) {
		checkActiveRead();
		MergingIterator<ZooPC> iter = 
				new MergingIterator<ZooPC>(this, config.getFailOnClosedQueries());
        ZooClassDef def = cache.getSchema(cls, primary);
		loadAllInstances(def.getVersionProxy(), subClasses, iter, loadFromCache);
		if (loadFromCache) {
			//also add 'new' instances
			iter.add(cache.iterator(def, subClasses, ObjectState.PERSISTENT_NEW));
		}
		return iter;
	}
627647
def get_superclass(self, class_):
        
        if not class_.is_loaded or class_.superclass_name is None:
            return None
        return self.get_class(class_.superclass_name)
1972
def cached_classproperty(fun):
    
    @functools.wraps(fun)
    def get(cls):
        try:
            return cls.__cache[fun]
        except AttributeError:
            cls.__cache = {}
        except KeyError:  # pragma: no cover
            pass
        ret = cls.__cache[fun] = fun(cls)
        return ret
    return classproperty(get)
928968
@Override
	public void cacheResult(
		CPDefinitionVirtualSetting cpDefinitionVirtualSetting) {
		entityCache.putResult(CPDefinitionVirtualSettingModelImpl.ENTITY_CACHE_ENABLED,
			CPDefinitionVirtualSettingImpl.class,
			cpDefinitionVirtualSetting.getPrimaryKey(),
			cpDefinitionVirtualSetting);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] {
				cpDefinitionVirtualSetting.getUuid(),
				cpDefinitionVirtualSetting.getGroupId()
			}, cpDefinitionVirtualSetting);

		finderCache.putResult(FINDER_PATH_FETCH_BY_C_C,
			new Object[] {
				cpDefinitionVirtualSetting.getClassNameId(),
				cpDefinitionVirtualSetting.getClassPK()
			}, cpDefinitionVirtualSetting);

		cpDefinitionVirtualSetting.resetOriginalValues();
	}
468386
def cached(namespace=None, service="memory", debug=False):
    
    _service = getattr(debris.services, service)
    def wrapper(_f):
        @functools.wraps(_f)
        def _stash(self, *a, **k):
            if debug is False:
                # this request is cacheable
                try:
                    self.finish(_service.get(namespace))
                except LookupError:
                    _replace_finish(self, namespace, _service)
                    # get the result of this request
                    _f(self, *a, **k)
                return
            # request is not cacheable
            _f(self, *a, **k)
        return _stash
    return wrapper
1264639
private static Class<?> getClassWithCaching(String className,
      Configuration conf) {
    Class<?> classs = cachedClassObjects.get(className);
    if (classs == null) {
      try {
        classs = conf.getClassByName(className);
        if (cachedClassObjects.size() < CACHE_MAX_SIZE) {
          cachedClassObjects.put(className, classs);
        }
      } catch (ClassNotFoundException e) {
        throw new RuntimeException("readObject can't find class " + className,
            e);
      }
    }
    // for sanity check if the class is not null
    if (classs == null) {
      throw new RuntimeException("readObject can't find class " + className);
    }
    return classs;
  }
1018401
@Override
	public void cacheResult(CPDefinitionInventory cpDefinitionInventory) {
		entityCache.putResult(CPDefinitionInventoryModelImpl.ENTITY_CACHE_ENABLED,
			CPDefinitionInventoryImpl.class,
			cpDefinitionInventory.getPrimaryKey(), cpDefinitionInventory);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] {
				cpDefinitionInventory.getUuid(),
				cpDefinitionInventory.getGroupId()
			}, cpDefinitionInventory);

		finderCache.putResult(FINDER_PATH_FETCH_BY_CPDEFINITIONID,
			new Object[] { cpDefinitionInventory.getCPDefinitionId() },
			cpDefinitionInventory);

		cpDefinitionInventory.resetOriginalValues();
	}
669506
@Override
	public void cacheResult(CPFriendlyURLEntry cpFriendlyURLEntry) {
		entityCache.putResult(CPFriendlyURLEntryModelImpl.ENTITY_CACHE_ENABLED,
			CPFriendlyURLEntryImpl.class, cpFriendlyURLEntry.getPrimaryKey(),
			cpFriendlyURLEntry);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] {
				cpFriendlyURLEntry.getUuid(), cpFriendlyURLEntry.getGroupId()
			}, cpFriendlyURLEntry);

		finderCache.putResult(FINDER_PATH_FETCH_BY_G_C_L_U,
			new Object[] {
				cpFriendlyURLEntry.getGroupId(),
				cpFriendlyURLEntry.getClassNameId(),
				cpFriendlyURLEntry.getLanguageId(),
				cpFriendlyURLEntry.getUrlTitle()
			}, cpFriendlyURLEntry);

		finderCache.putResult(FINDER_PATH_FETCH_BY_G_C_C_L_U,
			new Object[] {
				cpFriendlyURLEntry.getGroupId(),
				cpFriendlyURLEntry.getClassNameId(),
				cpFriendlyURLEntry.getClassPK(),
				cpFriendlyURLEntry.getLanguageId(),
				cpFriendlyURLEntry.getUrlTitle()
			}, cpFriendlyURLEntry);

		finderCache.putResult(FINDER_PATH_FETCH_BY_G_C_C_L_M,
			new Object[] {
				cpFriendlyURLEntry.getGroupId(),
				cpFriendlyURLEntry.getClassNameId(),
				cpFriendlyURLEntry.getClassPK(),
				cpFriendlyURLEntry.getLanguageId(), cpFriendlyURLEntry.isMain()
			}, cpFriendlyURLEntry);

		cpFriendlyURLEntry.resetOriginalValues();
	}
122643
def _tp_cache(func):
    

    cached = functools.lru_cache()(func)
    _cleanups.append(cached.cache_clear)

    @functools.wraps(func)
    def inner(*args, **kwds):
        try:
            return cached(*args, **kwds)
        except TypeError:
            pass  # All real errors (not unhashable args) are raised below.
        return func(*args, **kwds)

    return inner
1136232
def _getCachedValue(obj, relicFunc, resultType):
    
    # If the value has not been previously cached, fetch 
    if not obj.cached:
        obj.cached = resultType()
        relicFunc(byref(obj.cached))
    return obj.cached
391059
def cache_key(self, method_name):
        """"""
        key = ""
        method = getattr(self, "cache_key_{}".format(method_name), None)
        if method:
            key = method()

        return key
538733
public void cacheClassInfo( String name, Class<?> value ) {
        if ( value != null ) {
            absoluteClassCache.put(name, value);
            // eagerly start the member cache
            memberCache.init(value);
        }
        else
            absoluteNonClasses.add( name );
    }