@Override public void clear() { cache.clearAll(); }
@Override public void clearCache(String cacheType) throws AdminException { if(cacheType.equals(Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE.name())){ this.embeddedServer.getRsCache().clearAll(); } else if(cacheType.equals(Admin.Cache.PREPARED_PLAN_CACHE.name())) { this.embeddedServer.getPpcCache().clearAll(); } else { throw new AdminProcessingException(RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40139, cacheType, Admin.Cache.QUERY_SERVICE_RESULT_SET_CACHE, Admin.Cache.PREPARED_PLAN_CACHE)); } }
prepPlanCache.clearAll(); caps.setCapabilitySupport(Capability.BATCHED_UPDATES, true); TestPreparedStatement.helpTestProcessing(preparedSql, values, expected, dataManager, capFinder, metadata, prepPlanCache, false, false, false,RealMetadataFactory.example1VDB()); prepPlanCache.clearAll(); caps.setCapabilitySupport(Capability.BATCHED_UPDATES, false); caps.setCapabilitySupport(Capability.BULK_UPDATE, true); prepPlanCache.clearAll(); caps.setCapabilitySupport(Capability.UPSERT, true); caps.setCapabilitySupport(Capability.BULK_UPDATE, true);
@Test public void testClearAll(){ SessionAwareCache<PreparedPlan> cache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); //create one for each session token helpPutPreparedPlans(cache, token, 1, 1); helpPutPreparedPlans(cache, token2, 1, 1); //should have one assertNotNull("Unable to get prepared plan from cache for token", cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ cache.clearAll(); //should not exist for token assertNull("Failed remove from cache", cache.get(new CacheID(token, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ //should not exist for token2 assertNull("Unable to get prepared plan from cache for token2", cache.get(new CacheID(token2, pi, EXAMPLE_QUERY + 1))); //$NON-NLS-1$ }