@Override public int getTotalEntries() { return cache.getTotalCacheEntries(); }
public CacheStatisticsMetadata buildCacheStats(String name) { CacheStatisticsMetadata stats = new CacheStatisticsMetadata(); stats.setName(name); stats.setHitRatio(getCacheHitRatio()); stats.setTotalEntries(this.getTotalCacheEntries()); stats.setRequestCount(this.getRequestCount()); return stats; } }
public CacheStatisticsMetadata buildCacheStats(String name) { CacheStatisticsMetadata stats = new CacheStatisticsMetadata(); stats.setName(name); stats.setHitRatio(getCacheHitRatio()); stats.setTotalEntries(this.getTotalCacheEntries()); stats.setRequestCount(this.getRequestCount()); return stats; } }
public CacheStatisticsMetadata buildCacheStats(String name) { CacheStatisticsMetadata stats = new CacheStatisticsMetadata(); stats.setName(name); stats.setHitRatio(this.getRequestCount() == 0?0:((double)this.getCacheHitCount()/this.getRequestCount())*100); stats.setTotalEntries(this.getTotalCacheEntries()); stats.setRequestCount(this.getRequestCount()); return stats; } }
private Command helpTest(String userSql, String viewSql, String expectedSql, ProcessorDataManager dm) throws Exception { TransformationMetadata metadata = TestUpdateValidator.example1(); TestUpdateValidator.createView(viewSql, metadata, "gx"); Command command = TestQueryRewriter.helpTestRewriteCommand(userSql, expectedSql, metadata); if (dm != null) { CommandContext context = createCommandContext(); SessionAwareCache<PreparedPlan> planCache = new SessionAwareCache<PreparedPlan>("preparedplan", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.PREPAREDPLAN, 0); context.setPreparedPlanCache(planCache); //$NON-NLS-1$ BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities(); caps.setFunctionSupport(SourceSystemFunctions.CONVERT, true); ProcessorPlan plan = helpGetPlan(helpParse(userSql), metadata, new DefaultCapabilitiesFinder(caps), context); List<?>[] expected = new List[] {Arrays.asList(1)}; helpProcess(plan, context, dm, expected); assertEquals(0, planCache.getTotalCacheEntries()); } return command; }
@Test public void testClear() { SessionAwareCache<Cachable> cache = new SessionAwareCache<Cachable>("resultset", DefaultCacheFactory.INSTANCE, SessionAwareCache.Type.RESULTSET, 0); DQPWorkContext context = buildWorkContext(); CacheID id = new CacheID(context, new ParseInfo(), "SELECT * FROM FOO"); Cachable result = Mockito.mock(Cachable.class); Mockito.stub(result.prepare((BufferManager)anyObject())).toReturn(true); Mockito.stub(result.restore((BufferManager)anyObject())).toReturn(true); id = new CacheID(context, new ParseInfo(), "SELECT * FROM FOO"); cache.put(id, Determinism.VDB_DETERMINISTIC, result, null); id = new CacheID(context, new ParseInfo(), "SELECT * FROM FOO1"); cache.put(id, Determinism.VDB_DETERMINISTIC, result, null); assertEquals(2, cache.getTotalCacheEntries()); cache.clearForVDB(context.getVdbName(), context.getVdbVersion()); assertEquals(0, cache.getTotalCacheEntries()); }
ts.closeSource(); assertEquals(1, this.rm.getRsCache().getCachePutCount()); assertEquals(1, this.rm.getRsCache().getTotalCacheEntries()); assertEquals(2, this.rm.getRsCache().getTotalCacheEntries());