/** * Add a given name to the cache or track use count. * exist. If the name already exists, then the internal value is returned. * * @param name name to be looked up * @return internal value for the name if found; otherwise null */ K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment(); if (useCount.get() >= useThreshold) { promote(name); } return useCount.value; } useCount = new UseCount(name); transientMap.put(name, useCount); } return null; }
/** * Add a given name to the cache or track use count. * exist. If the name already exists, then the internal value is returned. * * @param name name to be looked up * @return internal value for the name if found; otherwise null */ K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment(); if (useCount.get() >= useThreshold) { promote(name); } return useCount.value; } useCount = new UseCount(name); transientMap.put(name, useCount); } return null; }
/** * Add a given name to the cache or track use count. * exist. If the name already exists, then the internal value is returned. * * @param name name to be looked up * @return internal value for the name if found; otherwise null */ K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment(); if (useCount.get() >= useThreshold) { promote(name); } return useCount.value; } useCount = new UseCount(name); transientMap.put(name, useCount); } return null; }
/** * Add a given name to the cache or track use count. * exist. If the name already exists, then the internal value is returned. * * @param name name to be looked up * @return internal value for the name if found; otherwise null */ K put(final K name) { K internal = cache.get(name); if (internal != null) { lookups++; return internal; } // Track the usage count only during initialization if (!initialized) { UseCount useCount = transientMap.get(name); if (useCount != null) { useCount.increment(); if (useCount.get() >= useThreshold) { promote(name); } return useCount.value; } useCount = new UseCount(name); transientMap.put(name, useCount); } return null; }