Register defined operation or function class to global cache

@param declare
502597
private void detectImplmentedExtension(Class declare) {
        Class c = BindExtensionProvider.getExtension(declare);
        if (c == null && declare.isAnnotationPresent(BindExtension.class)) {
            BindExtension impl = (BindExtension) declare.getAnnotation(BindExtension.class);
            if (impl != null)
                c = impl.implementation();
            BindExtensionProvider.bind(declare, c);
        }

        if (c != null) {
            if (Operator.class.isAssignableFrom(c))
                CacheExtension.setOperator(c);
            if (Function.class.isAssignableFrom(c))
                CacheExtension.setFunction(c);
        }
    }
436213
public static <T,R> void register(Class<T> from, Class<R> to, Function<T,R> transform) {
        REGISTRY.register(from, to, transform);
    }
914664
public void registerDeclaration(T declaration) {
        synchronized (declarationsRegistered) {
            if (declarationsRegistered.containsKey(declaration)) {
                throw new IllegalStateException("The given Declaration has already been registered.");
            }

            Dictionary<String, Object> props = new Hashtable<String, Object>();
            if(declaration.getMetadata().get("id") != null){
                props.put("importer.id",declaration.getMetadata().get("id").toString());

            }
            String[] clazzes = new String[]{klass.getName()};
            ServiceRegistration registration;
            registration = bundleContext.registerService(clazzes, declaration, props);

            declarationsRegistered.put(declaration, registration);
        }
    }
435393
private void bootstrap(String cacheName, AdvancedCache<?, ?> cache, Configuration configuration,
                          GlobalComponentRegistry globalComponentRegistry, StreamingMarshaller globalMarshaller) {
      this.configuration = configuration;

      // injection bootstrap stuff
      componentRegistry = new ComponentRegistry(cacheName, configuration, cache, globalComponentRegistry, globalComponentRegistry.getClassLoader());

      EncoderRegistry encoderRegistry = globalComponentRegistry.getComponent(EncoderRegistry.class);

      // Wraps the compatibility marshaller so that it can be used as a transcoder
      if (configuration.compatibility().enabled() && configuration.compatibility().marshaller() != null) {
         Marshaller marshaller = configuration.compatibility().marshaller();
         componentRegistry.wireDependencies(marshaller);
         if (!encoderRegistry.isConversionSupported(MediaType.APPLICATION_OBJECT, marshaller.mediaType())) {
            encoderRegistry.registerTranscoder(new TranscoderMarshallerAdapter(marshaller));
         }
      }

      // Wraps the GlobalMarshaller so that it can be used as a transcoder
      encoderRegistry.registerTranscoder(new TranscoderMarshallerAdapter(globalMarshaller));

      /*
         --------------------------------------------------------------------------------------------------------------
         This is where the bootstrap really happens.  Registering the cache in the component registry will cause
         the component registry to look at the cache's @Inject methods, and construct various components and their
         dependencies, in turn.
         --------------------------------------------------------------------------------------------------------------
       */
      basicComponentRegistry = componentRegistry.getComponent(BasicComponentRegistry.class);
      basicComponentRegistry.registerAlias(Cache.class.getName(), AdvancedCache.class.getName(), AdvancedCache.class);
      basicComponentRegistry.registerComponent(AdvancedCache.class.getName(), cache, false);

      componentRegistry.registerComponent(new CacheJmxRegistration(), CacheJmxRegistration.class.getName(), true);
      if (configuration.transaction().recovery().enabled()) {
         componentRegistry.registerComponent(new RecoveryAdminOperations(), RecoveryAdminOperations.class.getName(), true);
      }
      if (configuration.sites().hasEnabledBackups()) {
         componentRegistry.registerComponent(new XSiteAdminOperations(), XSiteAdminOperations.class.getName(), true);
      }
      // The RollingUpgradeManager should always be added so it is registered in JMX.
      componentRegistry.registerComponent(new RollingUpgradeManager(), RollingUpgradeManager.class.getName(), true);
   }
510792
def cache_check(compiler)
      ok = Mom::Label.new("cache_ok_#{self.object_id}")
      check = build_condition(ok, compiler)      # if cached_type != current_type
      check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , receiver_type_definition(compiler))
      check << Mom::ResolveMethod.new( @name , dynamic_call.cache_entry )
      check << ok
    end
701101
def dont_cache():
    
    def decorate_func(func):
        @wraps(func)
        def decorate_func_call(*a, **kw):
            callback = SetCacheControlHeadersForNoCachingCallback()
            registry_provider = AfterThisRequestCallbackRegistryProvider()
            registry = registry_provider.provide()
            registry.add(callback)
            return func(*a, **kw)
        return decorate_func_call
    return decorate_func
351293
@Override
   public void cacheStarting(ComponentRegistry cr, Configuration cfg, String cacheName) {
      BasicComponentRegistry gcr = cr.getGlobalComponentRegistry().getComponent(BasicComponentRegistry.class);
      InternalCacheRegistry icr = gcr.getComponent(InternalCacheRegistry.class).running();
      if (!icr.isInternalCache(cacheName)) {
         ProtobufMetadataManagerImpl protobufMetadataManager =
            (ProtobufMetadataManagerImpl) gcr.getComponent(ProtobufMetadataManager.class).running();
         protobufMetadataManager.addCacheDependency(cacheName);

         SerializationContext serCtx = protobufMetadataManager.getSerializationContext();
         RemoteQueryManager remoteQueryManager = buildQueryManager(cfg, serCtx, cr);
         cr.registerComponent(remoteQueryManager, RemoteQueryManager.class);

      }
   }
1244102
public void cache(Identity oid, Object obj)
    {
        doInternalCache(oid, obj, ObjectCacheInternal.TYPE_UNKNOWN);
    }
699000
@Override
	public void cacheResult(
		List<CPDefinitionLocalization> cpDefinitionLocalizations) {
		for (CPDefinitionLocalization cpDefinitionLocalization : cpDefinitionLocalizations) {
			if (entityCache.getResult(
						CPDefinitionLocalizationModelImpl.ENTITY_CACHE_ENABLED,
						CPDefinitionLocalizationImpl.class,
						cpDefinitionLocalization.getPrimaryKey()) == null) {
				cacheResult(cpDefinitionLocalization);
			}
			else {
				cpDefinitionLocalization.resetOriginalValues();
			}
		}
	}
589431
@SuppressWarnings("unchecked")
   public static <K, V> Cache<K, V> getGlobalCache() {
      if (caches.containsKey(GLOBAL_CACHE)) {
         return Cast.as(caches.get(GLOBAL_CACHE));
      }
      return register(getCacheSpec(GLOBAL_CACHE));
   }
370914
function cacheCollection(settings, cacheModules){
  var self = this;

  /**
   * Initialize cacheCollection given the provided constructor params
   */
  function init(){
    self.caches = [];
    if(isEmpty(cacheModules)){
      log(false, 'No cacheModules array provided--using the default configuration.');
      getDefaultConfiguration();
    }
    else{
      log(false, 'cacheModules array provided--using a custom configuration.');
      getCustomConfiguration();
      if(self.caches.length < 1){
        throw new Exception('NoCacheException', 'No caches were succesfully initialized.');
      }
    }
  }

  /**
   * Adds a nodeCacheModule instance to self.caches if no cacheModules array is provided
   */
  function getDefaultConfiguration(){
    var CModule = require('cache-service-cache-module');
    var cacheModule = new CModule();
    cacheModule = addSettings(cacheModule);
    self.caches.push(cacheModule);
  }

  /**
   * Adds caches that are not 'empty' from the cacheModules array to self.caches
   */
  function getCustomConfiguration(){
    for(var i = 0; i < cacheModules.length; i++){
      var cacheModule = cacheModules[i];
      if(isEmpty(cacheModule)){
        log(true, 'Cache module at index ' + i + ' is \'empty\'.');
        continue;
      }
      cacheModule = addSettings(cacheModule);
      self.caches.push(cacheModule);
    }
  }

  /**
   * Adds cache-service config properties to each cache module
   * @param {object} cacheModule
   * @return {object} cacheModule
   */
  function addSettings(cacheModule){
    cacheModule.nameSpace = settings.nameSpace;
    cacheModule.verbose = settings.verbose;
    return cacheModule;
  }

  /**
   * Checks if a value is "empty"
   * @param {object | string | null | undefined} val
   * @return {boolean}
   */
  function isEmpty (val) {
    return (val === undefined || val === false || val === null ||
      (typeof val === 'object' && Object.keys(val).length === 0));
  }

  /**
   * Instantates an exception to be thrown
   * @param {string} name
   * @param {string} message
   * @return {exception}
   */
  function Exception(name, message){
    this.name = name;
    this.message = message;
  }

  /**
   * Logging utility function
   * @param {boolean} isError
   * @param {string} message
   * @param {object} data
   */
  function log(isError, message, data){
    var indentifier = 'cacheService: ';
    if(self.verbose || isError){
      if(data) {
        console.log(indentifier + message, data);
      } else {
        console.log(indentifier + message);
      }
    }
  }

  init();
}
378204
function (fn) { var cache = {}  // barrier-enabled impl, eliminates redundant fetches
                                                    // in this version, any subsequent calls join at barrier (which opens when result is fetched)
        switch (_.numArgs (fn)) {
            case 1:
                return function (then) {             
                    if (!cache.already) {
                        fn.call (this, (cache = _.barrier ())) }
                    cache (then) }
            case 2:
                cache = {}
                return function (value, then) {    
                    if (!(value in cache)) {
                        fn.call (this, value, (cache[value] = _.barrier ())) }
                    cache[value] (then) }
            default:
                throw new Error ('_.cps.memoize: unsupported number of arguments') } }
995433
public static <K, V> void registerCacheObject(AbstractJCache<K, V> cache, ObjectNameType objectNameType) {
      //these can change during runtime, so always look it up
      MBeanServer mBeanServer = cache.getMBeanServer();
      if (mBeanServer != null) {
         ObjectName registeredObjectName = calculateObjectName(cache, objectNameType);
         try {
            if (objectNameType.equals(ObjectNameType.CONFIGURATION)) {
               if (!isRegistered(cache, objectNameType)) {
                  SecurityActions.registerMBean(cache.getCacheMXBean(), registeredObjectName, mBeanServer);
               }
            } else if (objectNameType.equals(ObjectNameType.STATISTICS)) {
               if (!isRegistered(cache, objectNameType)) {
                  SecurityActions.registerMBean(cache.getCacheStatisticsMXBean(), registeredObjectName, mBeanServer);
               }
            }
         } catch (Exception e) {
            throw new CacheException("Error registering cache MXBeans for CacheManager "
                  + registeredObjectName + " . Error was " + e.getMessage(), e);
         }
      }
   }
1372539
private void injectCache(Consumer<? super R> cacheAware) {
      if (cacheAware instanceof CacheAware) {
         ((CacheAware) cacheAware).injectCache(registry.getComponent(Cache.class));
      }
   }
874134
public static void addLazyDefinitions(SourceBuilder code) {
    Set<Declaration> defined = new HashSet<>();

    // Definitions may lazily declare new names; ensure we add them all
    List<Declaration> declarations =
        code.scope().keysOfType(Declaration.class).stream().sorted().collect(toList());
    while (!defined.containsAll(declarations)) {
      for (Declaration declaration : declarations) {
        if (defined.add(declaration)) {
          code.add(code.scope().get(declaration).definition);
        }
      }
      declarations = code.scope().keysOfType(Declaration.class).stream().sorted().collect(toList());
    }
  }
903324
private void injectCache(LongConsumer cacheAware) {
      if (cacheAware instanceof CacheAware) {
         ((CacheAware) cacheAware).injectCache(registry.getComponent(Cache.class));
      }
   }
692774
public static void initialize(final Class<?> _class)
        throws CacheReloadException
    {
        if (InfinispanCache.get().exists(Type.UUIDCACHE)) {
            InfinispanCache.get().<UUID, Type>getCache(Type.UUIDCACHE).clear();
        } else {
            InfinispanCache.get().<UUID, Type>getCache(Type.UUIDCACHE).addListener(new CacheLogListener(Type.LOG));
        }
        if (InfinispanCache.get().exists(Type.IDCACHE)) {
            InfinispanCache.get().<Long, Type>getCache(Type.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, Type>getCache(Type.IDCACHE).addListener(new CacheLogListener(Type.LOG));
        }
        if (InfinispanCache.get().exists(Type.NAMECACHE)) {
            InfinispanCache.get().<String, Type>getCache(Type.NAMECACHE).clear();
        } else {
            InfinispanCache.get().<String, Type>getCache(Type.NAMECACHE).addListener(new CacheLogListener(Type.LOG));
        }
        if (InfinispanCache.get().exists(EnumType.CACHE)) {
            InfinispanCache.get().getCache(EnumType.CACHE).clear();
        }
        QueryCache.initialize();
    }