@Override
	public <T> T get(Object key, Resource resource, Provider<T> provider) {
		if(resource == null) {
			return provider.get();
		}
		CacheAdapter adapter = getOrCreate(resource);
		T element = adapter.<T>internalGet(key);
		if (element==null) {
			element = provider.get();
			cacheMiss(adapter);
			adapter.set(key, element);
		} else {
			cacheHit(adapter);
		}
		if (element == CacheAdapter.NULL) {
			return null;
		}
		return element;
	}
@ Override public < T > T get ( Object key , Resource resource , Provider < T > provider ) { if ( resource == null ) { return provider . get ( ) ; } CacheAdapter adapter = getOrCreate ( resource ) ; T element = adapter . < T > internalGet ( key ) ; if ( element == null ) { element = provider . get ( ) ; cacheMiss ( adapter ) ; adapter . set ( key , element ) ; } else { cacheHit ( adapter ) ; } if ( element == CacheAdapter . NULL ) { return null ; } return element ; }
Try to obtain the value that is cached for the given key in the given resource.
If no value is cached, the provider is used to compute it and store it afterwards.
@param resource the resource. If it is <code>null</code>, the provider will be used to compute the value.
@param key the cache key. May not be <code>null</code>.
@param provider the strategy to compute the value if necessary. May not be <code>null</code>.