void cachePutManyIds(Object parentId, String manyName, CachedManyIds entry) {

    ServerCache collectionIdsCache = cacheManager.getCollectionIdsCache(beanType, manyName).get();
    if (manyLog.isDebugEnabled()) {
      manyLog.debug("   PUT {}({}).{} - ids:{}", cacheName, parentId, manyName, entry);
    }
    collectionIdsCache.put(parentId, entry);
  }
 void manyPropClear(String propertyName) {
   ServerCache collectionIdsCache =
       cacheManager.getCollectionIdsCache(beanType, propertyName).get();
   if (manyLog.isDebugEnabled()) {
     manyLog.debug("   CLEAR {}(*).{} ", cacheName, propertyName);
   }
   collectionIdsCache.clear();
 }
 void manyPropRemove(String propertyName, Object parentId) {
   ServerCache collectionIdsCache =
       cacheManager.getCollectionIdsCache(beanType, propertyName).get();
   if (manyLog.isTraceEnabled()) {
     manyLog.trace("   REMOVE {}({}).{}", cacheName, parentId, propertyName);
   }
   collectionIdsCache.remove(parentId);
 }
 /** Return the CachedManyIds for a given bean many property. Returns null if not in the cache. */
 private CachedManyIds manyPropGet(Object parentId, String propertyName) {
   ServerCache collectionIdsCache =
       cacheManager.getCollectionIdsCache(beanType, propertyName).get();
   CachedManyIds entry = (CachedManyIds) collectionIdsCache.get(parentId);
   if (entry == null) {
     if (manyLog.isTraceEnabled()) {
       manyLog.trace("   GET {}({}).{} - cache miss", cacheName, parentId, propertyName);
     }
   } else if (manyLog.isDebugEnabled()) {
     manyLog.debug("   GET {}({}).{} - hit", cacheName, parentId, propertyName);
   }
   return entry;
 }
  /** Apply changes to the bean cache entry. */
  void cacheBeanUpdate(
      Object id, Map<String, Object> changes, boolean updateNaturalKey, long version) {

    ServerCache cache = getBeanCache();
    CachedBeanData existingData = (CachedBeanData) cache.get(id);
    if (existingData != null) {
      long currentVersion = existingData.getVersion();
      if (version > 0 && version < currentVersion) {
        if (beanLog.isDebugEnabled()) {
          beanLog.debug(
              "   REMOVE {}({}) - version conflict old:{} new:{}",
              cacheName,
              id,
              currentVersion,
              version);
        }
        cache.remove(id);
      } else {
        if (version == 0) {
          version = currentVersion;
        }
        CachedBeanData newData = existingData.update(changes, version);
        if (beanLog.isDebugEnabled()) {
          beanLog.debug("   UPDATE {}({})  changes:{}", cacheName, id, changes);
        }
        cache.put(id, newData);
      }

      if (updateNaturalKey) {
        Object oldKey = existingData.getData(naturalKeyProperty);
        if (oldKey != null) {
          if (natLog.isDebugEnabled()) {
            natLog.debug(".. update {} REMOVE({}) - old key for ({})", cacheName, oldKey, id);
          }
          naturalKeyCache.get().remove(oldKey);
        }
      }
    }
  }