protected void stop() { if (cacheFactory != null) { cacheFactory.destroy(); } }
public boolean isTransactional() { return this.localCache.isTransactional() || this.distributedCache.isTransactional(); }
public void setType (String type) { this.policy = Policy.valueOf(type); }
@Test public void testNegativeSizeCacheUsesDefault() { CacheConfiguration config = new CacheConfiguration(); config.setMaxEntries(-1); new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0); // -1 means unlimited in the infinispan }
public SessionAwareCache (String cacheName, final CacheFactory cacheFactory, final Type type, int maxStaleness) { assert (cacheFactory != null); this.localCache = cacheFactory.get(cacheName); if (type == Type.PREPAREDPLAN) { this.distributedCache = localCache; } else { this.distributedCache = cacheFactory.get(cacheName+REPL); if (this.distributedCache == null && this.localCache != null) { this.distributedCache = this.localCache; } } this.modTime = maxStaleness * 1000; this.type = type; assert (this.localCache != null); assert (this.distributedCache != null); }
@Override public <K, V> Cache<K, V> get(String cacheName) { if (!destroyed) { return new MockCache<K, V>(cacheName, config.getMaxEntries()); } throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30562, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30562)); }
@Override public V put(K key, V value, Long ttl) { return put(key, value); }
public boolean isTransactional() { return this.localCache.isTransactional() || this.distributedCache.isTransactional(); }
public void setType (String type) { this.policy = Policy.valueOf(type); }
public SessionAwareCache (String cacheName, final CacheFactory cacheFactory, final Type type, int maxStaleness) { assert (cacheFactory != null); this.localCache = cacheFactory.get(cacheName); if (type == Type.PREPAREDPLAN) { this.distributedCache = localCache; } else { this.distributedCache = cacheFactory.get(cacheName+REPL); if (this.distributedCache == null && this.localCache != null) { this.distributedCache = this.localCache; } } this.modTime = maxStaleness * 1000; this.type = type; assert (this.localCache != null); assert (this.distributedCache != null); }
public boolean isTransactional() { return this.localCache.isTransactional() || this.distributedCache.isTransactional(); }
public void setType (String type) { this.policy = Policy.valueOf(type); }