Start Infinispan cache in privileged mode.

@param cache
176625
public static void start(final Cache<Serializable, Object> cache)
   {
      PrivilegedAction<Object> action = new PrivilegedAction<Object>()
      {
         public Object run()
         {
            cache.start();
            return null;
         }
      };
      SecurityHelper.doPrivilegedAction(action);
   }
310646
public void start() {
      this.stateCache = cacheManager
            .<ScopedState, CounterConfiguration>getCache(GlobalConfigurationManager.CONFIG_STATE_CACHE_NAME)
            .getAdvancedCache();
      listener = new CounterConfigurationListener();
      Map<String, CounterConfiguration> persisted = storage.loadAll();
      persisted.forEach((name, cfg) -> stateCache.putIfAbsent(stateKey(name), cfg));
      counterCacheStarted.set(false);
      stateCache.addListener(listener, new ScopeFilter(COUNTER_SCOPE));
      if (!persisted.isEmpty() || stateCache.keySet().stream()
            .anyMatch(scopedState -> COUNTER_SCOPE.equals(scopedState.getScope()))) {
         //we have counter defined
         startCounterCache();
      }
   }
283220
private synchronized void initCache() {

    if (this.cache == null) {
      ClasspathFolder rootFolder = new ClasspathFolder(null, "");
      Set<String> resourceNames = this.reflectionUtil.findResourceNames("", true, ConstantFilter.getInstance(true));
      List<ClasspathFile> fileList = new ArrayList<>(resourceNames.size());
      for (String resource : resourceNames) {
        ResourcePathNode<Void> path = ResourcePathNode.create(resource);
        ClasspathFolder parent = createFolderRecursive(path.getParent(), rootFolder);
        ClasspathFile file = new ClasspathFile(parent, path.getName());
        parent.children.add(file);
        fileList.add(file);
      }
      this.cache = new Cache(rootFolder, fileList);
    }
  }
710297
def _cache_init(self):
        """"""
        cache_ = cache.get(self.CACHE_KEY)
        if cache_ is None:
            cache_ = defaultdict(dict)
        self._cache = cache_
195676
void initialize(ScheduledExecutorService executor, String cacheName, Configuration cfg) {
      this.executor = executor;
      this.configuration = cfg;
      this.cacheName = cacheName;
   }
1160911
public function setCache($cache)
    {
        if ($cache instanceof Cache ||
            (class_exists('\Doctrine\Common\Cache\CacheProvider') && $cache instanceof \Doctrine\Common\Cache\CacheProvider)
        ) {
            $this->cache = $cache;
            return;
        }

        throw new \Exception('Cache not supported');
    }
694902
private synchronized void startCache()
    {
        for (PDatabase pDatabase : m_htDBList.values())
        {
            for (PTable pTable : pDatabase.getTableList().values())
            {
                this.addTableToCache(pTable);
            }
        }
    }
295161
public void start() {
        stop();  // Make sure any currently running dispatchers are stopped.
        // Create the cache dispatcher and start it.


        if (cacheDispatcher == null) {
            cacheDispatcher = new CacheDispatcher(cacheQueue, networkQueue, cache, delivery);
        }
        cacheDispatcher.start();
        addMarker(EVENT_CACHE_DISPATCHER_START, cacheDispatcher);

        // Create network dispatchers (and corresponding threads) up to the pool size.
        setUpNetworkDispatchers();
    }
135326
public static void initialize(final Class<?> _class)
        throws CacheReloadException
    {
        if (InfinispanCache.get().exists(Status.UUIDCACHE4GRP)) {
            InfinispanCache.get().<UUID, Status>getCache(Status.UUIDCACHE4GRP).clear();
        } else {
            InfinispanCache.get().<UUID, Status>getCache(Status.UUIDCACHE4GRP)
                            .addListener(new CacheLogListener(Status.LOG));
        }
        if (InfinispanCache.get().exists(Status.IDCACHE4STATUS)) {
            InfinispanCache.get().<Long, Status>getCache(Status.IDCACHE4STATUS).clear();
        } else {
            InfinispanCache.get().<Long, Status>getCache(Status.IDCACHE4STATUS)
                            .addListener(new CacheLogListener(Status.LOG));
        }
        if (InfinispanCache.get().exists(Status.NAMECACHE4GRP)) {
            InfinispanCache.get().<String, StatusGroup>getCache(Status.NAMECACHE4GRP).clear();
        } else {
            InfinispanCache.get().<String, StatusGroup>getCache(Status.NAMECACHE4GRP)
                            .addListener(new CacheLogListener(Status.LOG));
        }
    }
815307
public static void initialize()
    {
        if (InfinispanCache.get().exists(AccessSet.UUIDCACHE)) {
            InfinispanCache.get().<UUID, AccessSet>getCache(AccessSet.UUIDCACHE).clear();
        } else {
            InfinispanCache.get().<UUID, AccessSet>getCache(AccessSet.UUIDCACHE)
                            .addListener(new CacheLogListener(AccessSet.LOG));
        }
        if (InfinispanCache.get().exists(AccessSet.IDCACHE)) {
            InfinispanCache.get().<Long, AccessSet>getCache(AccessSet.IDCACHE).clear();
        } else {
            InfinispanCache.get().<Long, AccessSet>getCache(AccessSet.IDCACHE)
                            .addListener(new CacheLogListener(AccessSet.LOG));
        }
        if (InfinispanCache.get().exists(AccessSet.NAMECACHE)) {
            InfinispanCache.get().<String, AccessSet>getCache(AccessSet.NAMECACHE).clear();
        } else {
            InfinispanCache.get().<String, AccessSet>getCache(AccessSet.NAMECACHE)
                            .addListener(new CacheLogListener(AccessSet.LOG));
        }
    }
46402
public function initCache(Cache $cache, $enableCache = false)
    {
        $this->cache          = $cache;
        $this->isCacheEnabled = $enableCache;

        if ($enableCache) {
            $this->cache->enable();
        } else {
            $this->cache->disable();
        }

        return $this;
    }
1257320
public static void initialize()
        throws CacheReloadException
    {
        Field.initialize();

        if (InfinispanCache.get().exists(AbstractUserInterfaceObject.getUUIDCacheName(Command.class))) {
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Command.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Command.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Command.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Menu.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Menu.class)).clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Menu.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Image.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Image.class)).clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Image.class))
                            .clear();

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Search.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Search.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Search.class))
                            .clear();

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Form.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Form.class)).clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Form.class))
                            .clear();

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Table.class))
                            .clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Table.class)).clear();
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Table.class))
                            .clear();
        } else {
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Command.class))
                            .addListener(new CacheLogListener(Command.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Command.class))
                            .addListener(new CacheLogListener(Command.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Command.class))
                            .addListener(new CacheLogListener(Command.LOG));

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Menu.class))
                            .addListener(new CacheLogListener(Menu.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Menu.class))
                            .addListener(new CacheLogListener(Menu.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Menu.class))
                            .addListener(new CacheLogListener(Menu.LOG));

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Image.class))
                            .addListener(new CacheLogListener(Image.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Image.class))
                            .addListener(new CacheLogListener(Image.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Image.class))
                            .addListener(new CacheLogListener(Image.LOG));

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Search.class))
                            .addListener(new CacheLogListener(Search.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Search.class))
                            .addListener(new CacheLogListener(Search.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Search.class))
                            .addListener(new CacheLogListener(Search.LOG));

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Form.class))
                            .addListener(new CacheLogListener(Form.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Form.class))
                            .addListener(new CacheLogListener(Form.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Form.class))
                            .addListener(new CacheLogListener(Form.LOG));

            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getUUIDCacheName(Table.class))
                            .addListener(new CacheLogListener(Table.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getIDCacheName(Table.class))
                            .addListener(new CacheLogListener(Table.LOG));
            InfinispanCache.get().<UUID, Type>getCache(AbstractUserInterfaceObject.getNameCacheName(Table.class))
                            .addListener(new CacheLogListener(Table.LOG));
        }
        BundleMaker.initialize();
    }
201334
@Inject
   public void preStart() {
      // We have to do this before start, since some components may start before the actual cache and they
      // have to have access to the default metadata on some operations
      defaultMetadata = new EmbeddedMetadata.Builder()
            .lifespan(config.expiration().lifespan()).maxIdle(config.expiration().maxIdle()).build();
      transactional = config.transaction().transactionMode().isTransactional();
      batchingEnabled = config.invocationBatching().enabled();
   }
629704
public void run(Cache<G> cache, Code<G> code) throws APIException, IOException {
		code.code(cache, xgen);
	}
233585
public void setCacheMinutes(int iMinutes)
    {
        if (iMinutes == -1)
            iMinutes = DEFAULT_CACHED_MINUTES;      // Default cache time.
        cacheMinutes = iMinutes;
        if (iMinutes == 0)
        {
            if (timerCache != null)
            {
                timerCache.cancel();
                timerCache = null;
                this.stopCache();
            }
        }
        else
        {
            if (timerCache != null)
            {
                timerCache.cancel();   //m_timerCache.setDelay(iMilliseconds);
            }
          // Set up the timer for the first time.
            this.startCache();
            timerTask = new DBTimerTask();
            timerCache = new java.util.Timer();
            timerCache.schedule(timerTask, cacheMinutes * 60 * 1000);
        }
    }
340451
@Inject
   protected void init(EmbeddedCacheManager cacheManager, InternalCacheRegistry internalCacheRegistry) {
      this.cacheManager = cacheManager;
      internalCacheRegistry.registerInternalCache(PROTOBUF_METADATA_CACHE_NAME,
            getProtobufMetadataCacheConfig().build(),
            EnumSet.of(Flag.USER, Flag.PROTECTED, Flag.PERSISTENT));
   }
257080
public static void initialize()
    {
        if (InfinispanCache.get().exists(DBProperties.CACHENAME)) {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME).clear();
        } else {
            InfinispanCache.get().<String, String>getCache(DBProperties.CACHENAME)
                            .addListener(new CacheLogListener(DBProperties.LOG));
        }
        DBProperties.cacheOnStart();
    }