Synchronise the alerts configuration with the cache.
@param cache The provider cache
@return <CODE>true</CODE> if the operation was successful
973688
public boolean syncAlerts(NewRelicCache cache)
    {
        boolean ret = true;

        if(apiClient == null)
            throw new IllegalArgumentException("null API client");

        // Get the alert configuration using the REST API
        if(cache.isAlertsEnabled())
        {
            ret = false;

            // Get the alert policies
            logger.info("Getting the alert policies");
            Collection<AlertPolicy> policies = apiClient.alertPolicies().list();
            for(AlertPolicy policy : policies)
            {
                cache.alertPolicies().add(policy);

                // Add the alert conditions
                if(cache.isApmEnabled() || cache.isServersEnabled() || cache.isBrowserEnabled() || cache.isMobileEnabled())
                    cache.alertPolicies().alertConditions(policy.getId()).add(apiClient.alertConditions().list(policy.getId()));
                cache.alertPolicies().nrqlAlertConditions(policy.getId()).add(apiClient.nrqlAlertConditions().list(policy.getId()));
                if(cache.isApmEnabled() || cache.isMobileEnabled())
                    cache.alertPolicies().externalServiceAlertConditions(policy.getId()).add(apiClient.externalServiceAlertConditions().list(policy.getId()));
                if(cache.isSyntheticsEnabled())
                    cache.alertPolicies().syntheticsAlertConditions(policy.getId()).add(apiClient.syntheticsAlertConditions().list(policy.getId()));
                if(cache.isPluginsEnabled())
                    cache.alertPolicies().pluginsAlertConditions(policy.getId()).add(apiClient.pluginsAlertConditions().list(policy.getId()));
                if(cache.isInfrastructureEnabled())
                    cache.alertPolicies().infraAlertConditions(policy.getId()).add(infraApiClient.infraAlertConditions().list(policy.getId()));
            }

            // Get the alert channels
            logger.info("Getting the alert channels");
            Collection<AlertChannel> channels = apiClient.alertChannels().list();
            cache.alertChannels().set(channels);
            cache.alertPolicies().setAlertChannels(channels);
            cache.setUpdatedAt();

            ret = true;
        }

        return ret;
    }
1311294
@Override
	public void cacheResult(
		List<CommerceNotificationAttachment> commerceNotificationAttachments) {
		for (CommerceNotificationAttachment commerceNotificationAttachment : commerceNotificationAttachments) {
			if (entityCache.getResult(
						CommerceNotificationAttachmentModelImpl.ENTITY_CACHE_ENABLED,
						CommerceNotificationAttachmentImpl.class,
						commerceNotificationAttachment.getPrimaryKey()) == null) {
				cacheResult(commerceNotificationAttachment);
			}
			else {
				commerceNotificationAttachment.resetOriginalValues();
			}
		}
	}
1355331
def _caching_enabled(self):
        """"""
        try:
            config = self._runtime.get_configuration()
            parameter_id = Id('parameter:useCachingForQualifierIds@json')
            if config.get_value_by_parameter(parameter_id).get_boolean_value():
                return True
            else:
                return False
        except (AttributeError, KeyError, errors.NotFound):
            return False
879990
public static QueryCache getQueryCache(Cache<?, ?> cache) {
      return SecurityActions.getCacheGlobalComponentRegistry(cache.getAdvancedCache()).getComponent(QueryCache.class);
   }
609176
public void checkCacheMode(Boolean boolShouldBeCached)
    {
        try {
            boolean bCurrentlyCached = (this.getRemoteTableType(CachedRemoteTable.class) != null);
            if ((this.getRecord().getOpenMode() & DBConstants.OPEN_CACHE_RECORDS) == DBConstants.OPEN_CACHE_RECORDS)
                boolShouldBeCached = Boolean.TRUE;
//            if ((this.getRecord().getOpenMode() & DBConstants.OPEN_READ_ONLY) == DBConstants.OPEN_READ_ONLY);
//                    bShouldBeCached = true;
            if ((this.getRecord().getOpenMode() & DBConstants.OPEN_DONT_CACHE) == DBConstants.OPEN_DONT_CACHE)
                boolShouldBeCached = Boolean.FALSE;
            if (boolShouldBeCached == null)
                return;     // Not specified, Don't change.
            if ((!bCurrentlyCached) && (boolShouldBeCached.booleanValue()))
            {   // Add a cache
                Utility.getLogger().info("Cache ON: " + this.getRecord().getTableNames(false));
                this.setRemoteTable(new CachedRemoteTable(m_tableRemote));
            }
            else if ((bCurrentlyCached) && (!boolShouldBeCached.booleanValue()))
            {   // Remove the cache
                Utility.getLogger().info("Cache OFF: " + this.getRecord().getTableNames(false));
//                RemoteTable tableRemote = this.getRemoteTableType(org.jbundle.model.Remote.class);
                RemoteTable tableRemote = this.getRemoteTableType(CachedRemoteTable.class).getRemoteTableType(null);
                ((CachedRemoteTable)m_tableRemote).setRemoteTable(null);
                ((CachedRemoteTable)m_tableRemote).free();
                this.setRemoteTable(tableRemote);
            }
        } catch (RemoteException ex)    {
            // Never for this usage
        }
    }
627061
public final void useCache(final boolean useCache) {
        synchronized (cache) {
            this.useCache = useCache;
            logger.logDebug(getClass(), useCache ? "Enabled" : "Disabled" + " caching");

            if (!useCache) {
                clearCache();
            }
        }
    }
1245927
public void update(String cacheName, Cache cache) {
        cacheManager.enableManagement(cacheName, cache.isManagementEnabled());
        updateStatistics(cacheName, cache);
    }
718228
public void monitorCache(Ehcache cache) {
		if (this.isInitialized()) {
			cache.setStatisticsEnabled(true);
			final StagemonitorCacheUsageListener cacheUsageListener = new StagemonitorCacheUsageListener(cache.getName(),
				metricRegistry, timeGet.getValue());
			cache.registerCacheUsageListener(cacheUsageListener);
			metricRegistry.registerAny(new EhCacheMetricSet(cache.getName(), cache, cacheUsageListener));
		}
	}
721316
public static <K, V> Cache<K, V> unwrapCache(Cache<K, V> cache) {
      if (cache instanceof AbstractDelegatingCache) {
         return unwrapCache(((AbstractDelegatingCache<K, V>) cache).getDelegate());
      }
      return cache;
   }
559581
@Override
    public <K, V> Cache<K, V> getCache(String cacheName, boolean start) {
        Cache<K, V> cache = this.cm.getCache(this.getCacheName(cacheName), start);
        return (cache != null) ? new DelegatingCache<>(cache) : null;
    }
653288
public <K, V> AdvancedCache<K, V> decorateCache(AdvancedCache<K, V> cache) {
      return cache.transform(this::transform);
   }
401047
@Override
    public boolean containsCacheId(Object cacheId) {
        boolean found = false;
        if (cacheId != null) {
            found = this.coreCache.containsCacheId(cacheId);
        }
        return found;
    }
356297
static StorageCache initCache(Configuration configuration) {
    if (configuration.getBoolean(Configuration.CACHE_ENABLED) && configuration.getLong(Configuration.CACHE_BYTES) > 0) {
      return new StorageCache(configuration);
    } else {
      return new DisabledCache();
    }
  }
588810
@Override
    public Cache getCache(String cacheName) throws CacheException
    {
        if (this.cache == null)
        {
            this.cache = createCache(cacheName);
        }

        return this.cache;
    }
1072087
@Override
    public <K, V> Cache<K, V> getCache(String cacheName) {
        return this.getCache(cacheName, true);
    }
108208
public void code(Cache<G> cache, G xgen) throws APIException, IOException {
		code(null, null,cache,xgen);
	}
808689
@SuppressWarnings("unchecked")
    private static synchronized Map<String, Boolean> getCache(GraphRewrite event)
    {
        Map<String, Boolean> result = (Map<String, Boolean>)event.getRewriteContext().get(ClassificationServiceCache.class);
        if (result == null)
        {
            result = Collections.synchronizedMap(new LRUMap(30000));
            event.getRewriteContext().put(ClassificationServiceCache.class, result);
        }
        return result;
    }