Retrieves cache provider instance for method
182466
private static CacheProvider getCacheProvider(Method javaMethod) {
        if (!javaMethod.isAnnotationPresent(Cache.class)) {
            return null;
        }

        Cache an = javaMethod.getAnnotation(Cache.class);
        Class<? extends CacheProvider> cacheClazz = an.value();

        try {
            Constructor<? extends CacheProvider> constructor = cacheClazz.getDeclaredConstructor();
            constructor.setAccessible(true);
            return constructor.newInstance();
        } catch (Exception e) {
            throw new EventsException("Cannot instantiate cache provider "
                    + cacheClazz.getSimpleName() + " for method "
                    + Utils.methodToString(javaMethod), e);
        }
    }
243503
private void loadProtoClassToCache(String key, Class clazz, String methodName) {
        Method pbMethod = null;
        Method[] methods = clazz.getMethods();
        for (Method method : methods) {
            if (methodName.equals(method.getName())) {
                pbMethod = method;
                break;
            }
        }
        if (pbMethod == null) {
            throw new SofaRpcRuntimeException("Cannot found protobuf method: " + clazz.getName() + "." + methodName);
        }
        Class[] parameterTypes = pbMethod.getParameterTypes();
        if (parameterTypes == null
            || parameterTypes.length != 1
            || isProtoBufMessageObject(parameterTypes[0])) {
            throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName()
                + ", only support one protobuf parameter!");
        }
        Class reqClass = parameterTypes[0];
        requestClassCache.put(key, reqClass);
        Class resClass = pbMethod.getReturnType();
        if (resClass == void.class || !isProtoBufMessageClass(resClass)) {
            throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName()
                + ", only support return protobuf message!");
        }
        responseClassCache.put(key, resClass);
    }
394826
static synchronized CacheInstanceInfo [] getCacheInstanceInfo( CacheServiceImpl cacheService ) {
		CacheInstanceInfo infoOut [] = currentCacheInstanceInfoOut;
		if ( System.currentTimeMillis() - lastPopulate > populateInterval ) {
			if (cacheService!=null) {
				if ( cacheInstanceInfo == null ) {
					cacheInstanceInfo = new CacheInstanceInfo();
				}
				cacheService.populateCacheInstanceInfo( cacheInstanceInfo );
				CacheInstanceInfo.cacheService = cacheService;
				infoOut = new CacheInstanceInfo[allConfigured.size()];
				Iterator i = allConfigured.iterator();
				int x=0;
				while ( i.hasNext() ) {
					String cacheName =  (String)i.next();
					CacheInstanceInfo info = new CacheInstanceInfo();

					info.cacheName      = cacheName;
					info.isActive       = CacheInstanceInfo.allActive.contains(cacheName);
					info.isFactory      = CacheInstanceInfo.allFactory.contains(cacheName);
					info.isFile         = CacheInstanceInfo.allFile.contains(cacheName);
					info.isObjectCache  = CacheInstanceInfo.objectConfigured.contains(cacheName);
					info.isServletCache = CacheInstanceInfo.servletConfigured.contains(cacheName);

					infoOut[x++] = info;
				}
				currentCacheInstanceInfoOut = infoOut;
				CacheInstanceInfo.allConfigured.clear();
				CacheInstanceInfo.allActive.clear();
				CacheInstanceInfo.allFactory.clear();
				CacheInstanceInfo.allFile.clear();
				CacheInstanceInfo.objectConfigured.clear();
				CacheInstanceInfo.servletConfigured.clear();

			}
			lastPopulate = System.currentTimeMillis();
		}
		return infoOut;
	}
115025
def register_lazy_provider_method(self, cls, method):
        
        if 'provides' not in getattr(method, '__di__', {}):
            raise DiayException('method %r is not a provider' % method)

        @functools.wraps(method)
        def wrapper(*args, **kwargs):
            return getattr(self.get(cls), method.__name__)(*args, **kwargs)

        self.factories[method.__di__['provides']] = wrapper
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)
170684
def get_provider(self, name):
        """"""
        if name not in self.providers:
            cls = self.provider_classes[name]
            # instantiate the provider
            self.providers[name] = cls(self)
        return self.providers[name]
103109
def instance_cache(cls, func):
        

        @functools.wraps(func)
        def func_wrapper(*args, **kwargs):
            if not args:
                raise ValueError('`self` is not available.')
            else:
                the_self = args[0]
            func_key = cls.get_key(func)
            val_cache = cls.get_self_cache(the_self, func_key)
            lock = cls.get_self_cache_lock(the_self, func_key)

            return cls._get_value_from_cache(
                func, val_cache, lock, *args, **kwargs)

        return func_wrapper
376444
protected Object getFromCache(String cacheName, String key) {
        try {
            ICache cache = getCache(cacheName);
            return cache != null ? cache.get(key) : null;
        } catch (CacheException e) {
            LOGGER.warn(e.getMessage(), e);
            return null;
        }
    }
367238
def cached(func, instance, args, kwargs):
    """"""
    cache = getattr(instance, "__cache", None)
    if cache is None:
        instance.__cache = cache = {}
    try:
        return cache[func]
    except KeyError:
        cache[func] = result = func(*args, **kwargs)
        return result
1291179
def cached(func):
  
  class Cache(dict):
    def __missing__(self, key):
      result = self[key] = func(*key)
      return result
  cache = Cache()
  f = wraps(func)(lambda *key: cache[key])
  f.cache = cache
  return f
736354
def get_cache(self, decorated_function, *args, **kwargs):
		
		has_value = self.has(decorated_function, *args, **kwargs)
		cached_value = None
		if has_value is True:
			cached_value = self.get_result(decorated_function, *args, **kwargs)
		return WCacheStorage.CacheEntry(has_value=has_value, cached_value=cached_value)
787439
def cached(method):
    
    _cache_attr_name = '_cache_'+method.__name__
    _bool_attr_name  = '_cached_'+method.__name__
    def method_wrapper(self,*args,**kwargs):
        is_cached = getattr(self,_bool_attr_name)
        if not is_cached:
            result = method(self, *args, **kwargs)
            setattr(self, _cache_attr_name, result)
            setattr(self, _bool_attr_name, True)
        return getattr(self,'_cache_'+method.__name__)
    return method_wrapper
1336012
def _get_cache(self):
        
        if not self._cache:
            self._cache = get_cache(self.app)
        return self._cache
65398
private ObjectCache getCachePerClass(Class objectClass, int methodCall)
    {
        ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName());
        if (cache == null && AbstractMetaCache.METHOD_CACHE == methodCall
                && !cachesByClass.containsKey(objectClass.getName()))
        {
            cache = new ObjectCacheDefaultImpl(null, null);
            setClassCache(objectClass.getName(), cache);
        }
        return cache;
    }
89848
public Object getCache(Object key, String className) {
		return modelCacheManager.getCache(key, className);

	}
711917
public static MethodParameters of(Method method) {

		Assert.notNull(method, "Method must not be null!");

		return CACHE.computeIfAbsent(method, MethodParameters::new);
	}
205684
private function getCacheSettingsProvider(): CacheSettingsProviderInterface
    {
        if ($this->cacheSettingsProvider === null) {
            $provider = new CacheSettingsProvider();

            if (is_callable($method = $this->getSettingCacheMethod()) === true) {
                $data = call_user_func($method);
                $provider->unserialize($data);
            } else {
                $appConfig = $this->createApplicationConfiguration();
                $appData   = $appConfig->get();
                $coreData  = new CoreData(
                    $appData[A::KEY_ROUTES_PATH],
                    $appData[A::KEY_CONTAINER_CONFIGURATORS_PATH],
                    $appData[A::KEY_PROVIDER_CLASSES]
                );

                $provider->setInstanceSettings($appConfig, $coreData, $this->createInstanceSettingsProvider($appData));
            }

            $this->cacheSettingsProvider = $provider;
        }

        return $this->cacheSettingsProvider;
    }