/*
(non-Javadoc)

@see com.ibm.websphere.cache.CacheAdminMBean#getCacheEntry(java.lang.String, java.lang.String)
771893
@Override
    public String getCacheEntry(String cacheInstance, String cacheId) throws javax.management.AttributeNotFoundException { // 429429       

        if (cacheId == null) {
            throw new AttributeNotFoundException(cacheId + " is null.");
        }

        //Get the cache for this cacheInstance
        DCache cache1 = getCache(cacheInstance);
        //Get the cache entry

        EntryInfo ei = new EntryInfo();
        ei.setId(cacheId);
        com.ibm.websphere.cache.CacheEntry cacheEntry = cache1.getEntry(ei, true);

        String stringEntry = null;
        if (null != cacheEntry) {
            stringEntry = cacheEntry.toString();
            // Release cacheEntry and decrement referenced count for it before
            // return.
            cacheEntry.finish();
        }

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "getCacheEntry: Returning: " + stringEntry
                         + " for cacheInstance = " + cacheInstance);
        }

        return stringEntry;
    }
628861
@Override
    public com.ibm.websphere.cache.CacheEntry getEntryDisk(Object cacheId) {
        final String methodName = "getEntryDisk()";
        CacheEntry ce = null;
        if (this.swapToDisk) {
            // TODO write code to support getEntryDisk function
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
            }
        } else {
            if (this.featureSupport.isDiskCacheSupported() == false) {
                Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName });
            } else {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled");
                }
            }
        }
        return ce;
    }
578916
@ManagedAttribute(
         description = "Returns the cache name",
         displayName = "Cache name",
         dataType = DataType.TRAIT,
         displayType = DisplayType.SUMMARY
   )
   public String getCacheName() {
      String name = getName().equals(BasicCacheContainer.DEFAULT_CACHE_NAME) ? "Default Cache" : getName();
      return name + "(" + getCacheConfiguration().clustering().cacheMode().toString().toLowerCase() + ")";
   }
1072087
@Override
    public <K, V> Cache<K, V> getCache(String cacheName) {
        return this.getCache(cacheName, true);
    }
113574
public <T> T asSingleResult() {
		T javaObject = null;
		String cacheKey = getCacheKey();
		if (isCacheable() && transaction == null) {
			Collection<Key> keys = getCacheManager().get(cacheNamespace, cacheKey);
			if (keys != null && keys.size() > 0) {
				Key key = keys.iterator().next();
				try {
					javaObject = (T) entityManager.get(key);
				} catch (EntityNotFoundException e) {
					throw new InconsistentCacheException("Entity Key " + key + " found in the cache but not in the Datastore");
				}
			}
		}
		if (javaObject == null) {
			Entity entity = getDatastoreService().prepare(query).asSingleEntity();
			if (entity == null) {
				throw new org.simpleds.exception.EntityNotFoundException("No " + getKind() + " found with " + getFilterPredicates());
			}
			javaObject = (T) entityManager.datastoreToJava(entity);
			if (isCacheable()) {
                populateCache(cacheKey, ImmutableList.of(entity.getKey()));
			}
		}
		return javaObject;

	}
759291
@SuppressWarnings("rawtypes")
    protected PropertiesHolder getProperties(final String filename, final Resource resource) {
	    return CacheEntry.getValue(cachedProperties, filename, fileCacheMillis, new Callable<PropertiesHolder>() {
            @Override
            public PropertiesHolder call() throws Exception {
                return new PropertiesHolder(filename, resource);
            }
        }, new Callable<CacheEntry>() {
            @Override
            public CacheEntry call() throws Exception {
                return new PropertiesHolderCacheEntry();
            }
        }, true, null);
	}
1356557
public com.ibm.websphere.cache.CacheEntry getEntry(com.ibm.websphere.cache.EntryInfo ei) {
        return getEntry(ei, true);
    }
304287
@SuppressWarnings("unchecked")
  @Override
  public SpringCache2kCache getCache(final String name) {
    return name2cache.computeIfAbsent(name, n -> {
        if (!allowUnknownCache && !configuredCacheNames.contains(n)) {
          throw new IllegalArgumentException("Cache configuration missing for: " + n);
        }
        return buildAndWrap(Cache2kBuilder.forUnknownTypes().manager(manager).name(n));
      });
  }
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.");
    }
288764
private final synchronized CacheElement getCacheElement(String userid) {
        String m = getCacheAbbrev() + " getCacheElement() ";
        CacheElement cacheElement = null;
        String key = getKey(userid);
        logger.debug(m + "key==" + key);
        if (cache.containsKey(key)) {
            logger.debug(m + "cache already has element");
        } else {
            logger.debug(m + "cache does not have element; create and put");
            CacheElement itemtemp =
                    new CacheElement(userid, getCacheId(), getCacheAbbrev());
            cache.put(key, itemtemp);
        }
        cacheElement = (CacheElement) cache.get(key);
        if (cacheElement == null) {
            logger.error(m + "cache does not contain element");
        } else {
            logger.debug(m + "element retrieved from cache successfully");
        }
        return cacheElement;
    }
520551
public com.ibm.websphere.cache.CacheEntry getEntry(Object id) {
        return getEntry(id, CachePerf.LOCAL, IGNORE_COUNTING, !INCREMENT_REFF_COUNT);
    }
727869
public static <T> Maybe<T> get(String cacheKey, Class<T> clazz) {
        return get(CacheService.CACHE_CONFIG_BEAN, cacheKey, clazz);
    }
1160081
@Override
   public <K, V> RemoteCache<K, V> getCache() {
      return getCache(configuration.forceReturnValues());
   }
232227
@Override
    public Cache getCache(String id) {
        Exceptions.checkNotClosed(this.closed.get(), this);

        RocksDBCache result;
        boolean isNew = false;
        synchronized (this.caches) {
            result = this.caches.get(id);
            if (result == null) {
                result = new RocksDBCache(id, this.config, this::cacheClosed);
                this.caches.put(id, result);
                isNew = true;
            }
        }

        if (isNew) {
            result.initialize();
        }

        return result;
    }
1130926
public CacheEntry readCacheEntry(Object id) { // SKS-O
        Result result = htod.readCacheEntry(id);
        if (result.returnCode == HTODDynacache.DISK_EXCEPTION) {
            stopOnError(result.diskException);
            this.htod.returnToResultPool(result);
            return null;
        }
        CacheEntry cacheEntry = (CacheEntry) result.data;
        this.htod.returnToResultPool(result);
        return cacheEntry;
    }
991086
public com.ibm.wsspi.cache.CacheEntry getEntry(Object cacheId){
		CacheEntry cacheEntry = new CacheEntry(cacheInstance.getEntry(cacheId));	 
		return cacheEntry;
	}
604393
@SuppressWarnings("unchecked")
  @Override
  public <C extends Configuration<K, T>> C getConfiguration(Class<C> clazz) {
    final C c = cache.getConfiguration(clazz);
    if (c instanceof CompleteConfiguration) {
      final CompleteConfiguration<K, T> cc = (CompleteConfiguration<K,T>) c;
      return (C) new CompleteConfiguration<K, T>() {
        @Override
        public Iterable<CacheEntryListenerConfiguration<K, T>> getCacheEntryListenerConfigurations() {
          return cc.getCacheEntryListenerConfigurations();
        }

        @Override
        public boolean isReadThrough() {
          return cc.isReadThrough();
        }

        @Override
        public boolean isWriteThrough() {
          return cc.isWriteThrough();
        }

        @Override
        public boolean isStatisticsEnabled() {
          return cc.isStatisticsEnabled();
        }

        @Override
        public boolean isManagementEnabled() {
          return cc.isManagementEnabled();
        }

        @Override
        public Factory<CacheLoader<K, T>> getCacheLoaderFactory() {
          return cc.getCacheLoaderFactory();
        }

        @Override
        public Factory<CacheWriter<? super K, ? super T>> getCacheWriterFactory() {
          return cc.getCacheWriterFactory();
        }

        @Override
        public Factory<ExpiryPolicy> getExpiryPolicyFactory() {
          return cc.getExpiryPolicyFactory();
        }

        @Override
        public Class<K> getKeyType() {
          return cc.getKeyType();
        }

        @Override
        public Class<T> getValueType() {
          return cc.getValueType();
        }

        @Override
        public boolean isStoreByValue() {
          return true;
        }
      };
    } else if (c instanceof Configuration) {
      return (C) new Configuration<K, T>() {
        @Override
        public Class<K> getKeyType() {
          return c.getKeyType();
        }

        @Override
        public Class<T> getValueType() {
          return c.getValueType();
        }

        @Override
        public boolean isStoreByValue() {
          return true;
        }
      };
    }
    return c;
  }