mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#638 - ENH: Add Apache Ignite as L2 cache option
This commit is contained in:
@@ -46,4 +46,9 @@ public interface SpiServer extends EbeanServer {
|
||||
* Return the associated DataSource for this EbeanServer instance.
|
||||
*/
|
||||
DataSource getDataSource();
|
||||
|
||||
/**
|
||||
* Initialise the query cache for the given bean type.
|
||||
*/
|
||||
boolean initQueryCache(String key);
|
||||
}
|
||||
|
||||
@@ -2030,6 +2030,16 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
return beanDescriptorManager.getBeanDescriptorByClassName(beanClassName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initQueryCache(String key) {
|
||||
BeanDescriptor<?> desc = getBeanDescriptorById(key);
|
||||
if (desc != null) {
|
||||
desc.queryCacheInit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Another server in the cluster sent this event so that we can inform local
|
||||
* BeanListeners of inserts updates and deletes that occurred remotely (on
|
||||
|
||||
@@ -1075,6 +1075,10 @@ public class BeanDescriptor<T> implements MetaBeanInfo, BeanType<T> {
|
||||
return cacheHelp.isCacheNotify();
|
||||
}
|
||||
|
||||
public void queryCacheInit() {
|
||||
cacheHelp.queryCacheInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the query cache.
|
||||
*/
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class BeanDescriptorCacheHelp<T> {
|
||||
|
||||
private ServerCache beanCache;
|
||||
private ServerCache naturalKeyCache;
|
||||
private ServerCache queryCache;
|
||||
private volatile ServerCache queryCache;
|
||||
|
||||
public BeanDescriptorCacheHelp(BeanDescriptor<T> desc, ServerCacheManager cacheManager, CacheOptions cacheOptions,
|
||||
boolean cacheSharableBeans, BeanPropertyAssocOne<?>[] propertiesOneImported) {
|
||||
@@ -148,6 +148,17 @@ public final class BeanDescriptorCacheHelp<T> {
|
||||
return cacheOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the query cache if required
|
||||
* (as some node in the cluster already has it).
|
||||
*/
|
||||
public void queryCacheInit() {
|
||||
if (queryCache == null) {
|
||||
queryLog.debug(" init {}", cacheName);
|
||||
queryCache = cacheManager.getQueryCache(beanType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the query cache.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user