DistributedObjectCacheAdapter
491014
public static void sharingPolicy(int sharingPolicy) {
        if (verify) {
            if (sharingPolicy != EntryInfo.SHARED_PULL &&
                sharingPolicy != EntryInfo.SHARED_PUSH &&
                sharingPolicy != EntryInfo.SHARED_PUSH_PULL &&
                sharingPolicy != EntryInfo.NOT_SHARED) {
                    throw new IllegalArgumentException("sharingPolicy:"+sharingPolicy);
                }
        }
    }
587944
public void loadKeys(DataStructureAdapter<Object, ?> adapter) {
        if (!storeFile.exists()) {
            logger.info(format("Skipped loading keys of Near Cache %s since storage file doesn't exist (%s)", nearCacheName,
                    storeFile.getAbsolutePath()));
            return;
        }

        long startedNanos = System.nanoTime();
        BufferingInputStream bis = null;
        try {
            bis = new BufferingInputStream(new FileInputStream(storeFile), BUFFER_SIZE);
            if (!checkHeader(bis)) {
                return;
            }

            int loadedKeys = loadKeySet(bis, adapter);

            long elapsedMillis = getElapsedMillis(startedNanos);
            logger.info(format("Loaded %d keys of Near Cache %s in %d ms", loadedKeys, nearCacheName, elapsedMillis));
        } catch (Exception e) {
            logger.warning(format("Could not pre-load Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath()), e);
        } finally {
            closeResource(bis);
        }
    }
707239
@Override
    public Cache getCache()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "getCache : " + this);
        throw new UnsupportedOperationException("This operation is not supported on a pooling EntityManagerFactory.");
    }
669108
private static ProtobufMetadataManagerImpl getProtobufMetadataManager(EmbeddedCacheManager cacheManager) {
      if (cacheManager == null) {
         throw new IllegalArgumentException("cacheManager cannot be null");
      }
      ProtobufMetadataManagerImpl metadataManager = (ProtobufMetadataManagerImpl) cacheManager.getGlobalComponentRegistry().getComponent(ProtobufMetadataManager.class);
      if (metadataManager == null) {
         throw new IllegalStateException("ProtobufMetadataManager not initialised yet!");
      }
      return metadataManager;
   }
1200266
public void sync() throws Exception {
        try {
            JedisClusterPipeline pipeline = new JedisClusterPipeline(clusterInfoCache);
            execute(pipeline);
            pipeline.sync();
        } catch (JedisMovedDataException jre) {
            // if MOVED redirection occurred, rebuilds cluster's slot cache,
            // recommended by Redis cluster specification
            connectionHandler.renewSlotCache();
            if (maxAttempts > 0) {
                maxAttempts--;
                sync();
                return;
            }
            throw jre;
        } catch (Exception e) {
            throw e;
        }
    }
1119755
private void persistCache(String projectName, String projectVersion, Map<String, String> cache) {
		File cacheFile = new File(getCacheDir(), projectName + "/" + projectVersion);
		ObjectOutputStream oos = null;
		try {
			oos = new ObjectOutputStream(new FileOutputStream(cacheFile));
			oos.writeObject(cache);
		}
		catch (IOException ioe) {
			LOGGER.warn("Unable to create the cache file {}/{}/{}", getCacheDir().getAbsoluteFile(), projectName, projectVersion);
		}
		finally { if (oos != null) { try { oos.close(); } catch (IOException ioe) {} } }
	}
170349
@Override
    public void configureWriteCache(long initDelay, long delayCache, long cacheSize){
        client.initTimer(initDelay, delayCache,cacheSize);
    }
1240262
public void copy(CacheEntry cacheEntry) {

        if (cacheEntry == this)
            return;

        if (useByteBuffer && this.value != null) {
            if (this.value instanceof DistributedNioMapObject) {
                ((DistributedNioMapObject) this.value).release();
            }
        }

        this.value = cacheEntry.value;
        this.valueHashcode = cacheEntry.valueHashcode;
        this.serializedValue = cacheEntry.serializedValue;
        this.serializedId = cacheEntry.serializedId;
        timeStamp = cacheEntry.timeStamp;
        expirationTime = cacheEntry.expirationTime;
        validatorExpirationTime = cacheEntry.validatorExpirationTime;
        timeLimit = cacheEntry.timeLimit;
        inactivity = cacheEntry.inactivity;
        drsClock = cacheEntry.drsClock;
        id = cacheEntry.id;
        priority = cacheEntry.priority;
        if (priority < 0)
            priority = 0;
        if (priority > CacheConfig.MAX_PRIORITY)
            priority = CacheConfig.MAX_PRIORITY;
        _templates = cacheEntry._templates;
        _dataIds = cacheEntry._dataIds;
        _serializedDataIds = cacheEntry._serializedDataIds;
        sharingPolicy = cacheEntry.sharingPolicy;
        persistToDisk = cacheEntry.persistToDisk;
        refCount = new AtomicInteger(cacheEntry.refCount.get());
        aliasList = cacheEntry.aliasList;
        serializedAliasList = cacheEntry.serializedAliasList;
        useByteBuffer = cacheEntry.useByteBuffer;
        userMetaData = cacheEntry.userMetaData;
        serializedUserMetaData = cacheEntry.serializedUserMetaData;
        loadedFromDisk = cacheEntry.loadedFromDisk;
        cacheType = cacheEntry.cacheType;
        skipValueSerialized = cacheEntry.skipValueSerialized;
        skipMemoryAndWriteToDisk = cacheEntry.skipMemoryAndWriteToDisk;
        skipMemoryAndWriteToDiskErrorCode = cacheEntry.skipMemoryAndWriteToDiskErrorCode;
        vbcSource = cacheEntry.vbcSource;
        externalCacheGroupId = cacheEntry.externalCacheGroupId;
        //Note: clock is not set here because it's really owned
        //by the cache.  Only the cache should say when the clock
        //changes.  It makes the cache code more readable.
    }
830099
private @Nullable CacheWriterException writeAllToCacheWriter(Map<? extends K, ? extends V> map) {
    if (!configuration.isWriteThrough() || map.isEmpty()) {
      return null;
    }
    List<Cache.Entry<? extends K, ? extends V>> entries = map.entrySet().stream()
        .map(entry -> new EntryProxy<>(entry.getKey(), entry.getValue()))
        .collect(toList());
    try {
      writer.writeAll(entries);
      return null;
    } catch (CacheWriterException e) {
      entries.forEach(entry -> {
        map.remove(entry.getKey());
      });
      throw e;
    } catch (RuntimeException e) {
      entries.forEach(entry -> {
        map.remove(entry.getKey());
      });
      return new CacheWriterException("Exception in CacheWriter", e);
    }
  }
988526
private void deliverCacheUpdate(SlotReference slot, MetadataCache cache) {
        for (final MetadataCacheListener listener : getCacheListeners()) {
            try {
                if (cache == null) {
                    listener.cacheDetached(slot);
                } else {
                    listener.cacheAttached(slot, cache);
                }
            } catch (Throwable t) {
                logger.warn("Problem delivering metadata cache update to listener", t);
            }
        }
    }
287368
def _get_dataobject(self, name, multivalued):
        """"""
        logger.debug("Querying server for uncached data object %s", name)
        # This will retrieve the value and inject it into the cache
        self.update_view_data(properties=[name])
        return self._cache[name][0]
1259225
private void put(T item) {
        HashMap<String,Object> keys;

        if( item == null ) {
            throw new NullPointerException("Multi caches may not have null values.");
        }
        keys = getKeys(item);
        synchronized( this ) {
            for( String key : caches.keySet() ) {
                ConcurrentCache<Object,T> cache = caches.get(key);
                Object ob = keys.get(key);

                if( ob instanceof BigDecimal ) {
                    ob = ((BigDecimal)ob).longValue();
                }
                cache.put(ob, item);
            }
        }
    }
1143905
public void cache(Identity oid, Object obj)
    {
        try
        {
            jcsCache.put(oid.toString(), obj);
        }
        catch (CacheException e)
        {
            throw new RuntimeCacheException(e);
        }
    }
1363473
@Override
    public void discardObject(EJBCache wrapperCache, Object key, Object ele)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "discardObject", new Object[] { key, ele });

        EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele;
        wrapperCommon.disconnect(); // @MD20022C, F58064

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "discardObject");
    }
1335096
private CachedProviderServiceInstance getCachedServiceInstance(
            String serviceName, String providerAddress) {
        
		ServiceInstanceId id = new ServiceInstanceId(serviceName, providerAddress);
		return getCacheServiceInstances().get(id);
       
    }
569602
@Override
	public void cacheResult(CPDisplayLayout cpDisplayLayout) {
		entityCache.putResult(CPDisplayLayoutModelImpl.ENTITY_CACHE_ENABLED,
			CPDisplayLayoutImpl.class, cpDisplayLayout.getPrimaryKey(),
			cpDisplayLayout);

		finderCache.putResult(FINDER_PATH_FETCH_BY_UUID_G,
			new Object[] { cpDisplayLayout.getUuid(), cpDisplayLayout.getGroupId() },
			cpDisplayLayout);

		finderCache.putResult(FINDER_PATH_FETCH_BY_C_C,
			new Object[] {
				cpDisplayLayout.getClassNameId(), cpDisplayLayout.getClassPK()
			}, cpDisplayLayout);

		cpDisplayLayout.resetOriginalValues();
	}
292568
public synchronized void setCachedManagedObjectsSize(int cachedManagedObjectsSize)
                    throws ObjectManagerException
    {
        this.cachedManagedObjectsSize = cachedManagedObjectsSize;
        cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
        writeHeader();
        force();
    }