コード例 #1
0
  BeanDescriptorCacheHelp(
      BeanDescriptor<T> desc,
      SpiCacheManager cacheManager,
      CacheOptions cacheOptions,
      boolean cacheSharableBeans,
      BeanPropertyAssocOne<?>[] propertiesOneImported) {

    this.desc = desc;
    this.beanType = desc.rootBeanType;
    this.cacheName = beanType.getSimpleName();
    this.cacheManager = cacheManager;
    this.cacheOptions = cacheOptions;
    this.cacheSharableBeans = cacheSharableBeans;
    this.propertiesOneImported = propertiesOneImported;
    this.naturalKeyProperty = cacheOptions.getNaturalKey();

    if (!cacheOptions.isEnableQueryCache()) {
      this.queryCache = null;
    } else {
      this.queryCache = cacheManager.getQueryCache(beanType);
    }

    if (cacheOptions.isEnableBeanCache()) {
      this.beanCache = cacheManager.getBeanCache(beanType);
      if (cacheOptions.getNaturalKey() != null) {
        this.naturalKeyCache = cacheManager.getNaturalKeyCache(beanType);
      } else {
        this.naturalKeyCache = null;
      }
    } else {
      this.beanCache = null;
      this.naturalKeyCache = null;
    }
  }
コード例 #2
0
  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);
  }
コード例 #3
0
 void manyPropClear(String propertyName) {
   ServerCache collectionIdsCache =
       cacheManager.getCollectionIdsCache(beanType, propertyName).get();
   if (manyLog.isDebugEnabled()) {
     manyLog.debug("   CLEAR {}(*).{} ", cacheName, propertyName);
   }
   collectionIdsCache.clear();
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 /** 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;
 }