/** * Remove a collection of beans from the cache given the ids. */ public void cacheApplyInvalidate(Collection<Object> ids) { List<String> keys = new ArrayList<>(ids.size()); for (Object id : ids) { keys.add(cacheKey(id)); } cacheHelp.beanCacheApplyInvalidate(keys); }
@Override public void clearBeanCache() { cacheHelp.beanCacheClear(); }
/** * Return a bean from the bean cache (or null). */ public T cacheBeanGet(Object id, Boolean readOnly, PersistenceContext context) { return cacheHelp.beanCacheGet(cacheKey(id), readOnly, context); }
T beanCacheGet(String key, Boolean readOnly, PersistenceContext context) { T bean = beanCacheGetInternal(key, readOnly, context); if (bean != null) { setupContext(bean, context); } return bean; }
void beanPutAll(Collection<EntityBean> beans) { if (desc.inheritInfo != null) { Class<?> aClass = theClassOf(beans); // check if all beans have the same class for (EntityBean bean : beans) { if (!bean.getClass().equals(aClass)) { aClass = null; break; } } if (aClass == null) { // there are different bean types in the collection, so we add one by one to the cache for (EntityBean bean : beans) { desc.descOf(bean.getClass()).cacheBeanPutDirect(bean); } } else { desc.descOf(aClass).cacheBeanPutAllDirect(beans); } } else { beanCachePutAllDirect(beans); } }
/** * Hit the bean cache trying to load a list/batch of entities. * Return the set of entities that were successfully loaded from L2 cache. */ public Set<EntityBeanIntercept> cacheBeanLoadAll(List<EntityBeanIntercept> list, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName) { return cacheHelp.beanCacheLoadAll(list, persistenceContext, lazyLoadProperty, propertyName); }
/** * Returns true if it managed to populate/load the bean from the cache. */ public boolean cacheBeanLoad(EntityBean bean, EntityBeanIntercept ebi, Object id, PersistenceContext context) { return cacheHelp.beanCacheLoad(bean, ebi, cacheKey(id), context); }
/** * Put a bean into the bean cache (taking into account inheritance). */ public void cacheBeanPut(EntityBean bean) { cacheHelp.beanCachePut(bean); }
void cacheBeanPutAllDirect(Collection<EntityBean> beans) { cacheHelp.beanCachePutAllDirect(beans); }
CachedBeanData d = cacheHelp.beanCacheGetData(cacheKey(id)); if (d != null) { Object shareableBean = d.getSharableBean();
this.cacheHelp = new BeanDescriptorCacheHelp<>(this, owner.getCacheManager(), deploy.getCacheOptions(), cacheSharableBeans, propertiesOneImported); this.jsonHelp = new BeanDescriptorJsonHelp<>(this); this.draftHelp = new BeanDescriptorDraftHelp<>(this);
T beanCacheGet(String key, Boolean readOnly, PersistenceContext context) { T bean = beanCacheGetInternal(key, readOnly, context); if (bean != null) { setupContext(bean, context); } return bean; }
void beanPutAll(Collection<EntityBean> beans) { if (desc.inheritInfo != null) { Class<?> aClass = theClassOf(beans); // check if all beans have the same class for (EntityBean bean : beans) { if (!bean.getClass().equals(aClass)) { aClass = null; break; } } if (aClass == null) { // there are different bean types in the collection, so we add one by one to the cache for (EntityBean bean : beans) { desc.descOf(bean.getClass()).cacheBeanPutDirect(bean); } } else { desc.descOf(aClass).cacheBeanPutAllDirect(beans); } } else { beanCachePutAllDirect(beans); } }
/** * Hit the bean cache trying to load a list/batch of entities. * Return the set of entities that were successfully loaded from L2 cache. */ public Set<EntityBeanIntercept> cacheBeanLoadAll(List<EntityBeanIntercept> list, PersistenceContext persistenceContext, int lazyLoadProperty, String propertyName) { return cacheHelp.beanCacheLoadAll(list, persistenceContext, lazyLoadProperty, propertyName); }
/** * Returns true if it managed to populate/load the bean from the cache. */ public boolean cacheBeanLoad(EntityBean bean, EntityBeanIntercept ebi, Object id, PersistenceContext context) { return cacheHelp.beanCacheLoad(bean, ebi, cacheKey(id), context); }
/** * Put a bean into the bean cache (taking into account inheritance). */ public void cacheBeanPut(EntityBean bean) { cacheHelp.beanCachePut(bean); }
void cacheBeanPutAllDirect(Collection<EntityBean> beans) { cacheHelp.beanCachePutAllDirect(beans); }
CachedBeanData d = cacheHelp.beanCacheGetData(cacheKey(id)); if (d != null) { Object shareableBean = d.getSharableBean();
this.cacheHelp = new BeanDescriptorCacheHelp<>(this, owner.getCacheManager(), deploy.getCacheOptions(), cacheSharableBeans, propertiesOneImported); this.jsonHelp = new BeanDescriptorJsonHelp<>(this); this.draftHelp = new BeanDescriptorDraftHelp<>(this);
/** * Return a bean from the bean cache (or null). */ public T cacheBeanGet(Object id, Boolean readOnly, PersistenceContext context) { return cacheHelp.beanCacheGet(cacheKey(id), readOnly, context); }