@Override public CacheDirective getCacheDirective(Command command, ExecutionContext executionContext, RuntimeMetadata metadata) throws TranslatorException { if (cachePattern != null && cachePattern.matcher(command.toString()).matches()) { //return a new cache directive with defaults and ttl set CacheDirective cacheDirective = new CacheDirective(); cacheDirective.setTtl(cacheTtl); return cacheDirective; } return delegate.getCacheDirective(command, executionContext, metadata); }
if (!Boolean.FALSE.equals(cd.getUpdatable())) { if (accessedGroups != null) { for (GroupSymbol gs : accessedGroups) { cr.setRowLimit(rowNumber); tb.setPrefersMemory(Boolean.TRUE.equals(cd.getPrefersMemory())); Determinism determinismLevel = getDeterminismLevel(this.dtts.scope); this.dataTierManagerImpl.requestMgr.getRsCache().put(cid, determinismLevel, cr, cd.getTtl()); tb = null;
if (cd.getScope() == Scope.NONE) { parameterObject.doNotCache = true; } else { cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) { CachedResults cr = workItem.getRsCache().get(cid); if (cr != null && (cr.getRowLimit() == 0 || (parameterObject.limit > 0 && cr.getRowLimit() >= parameterObject.limit))) { return cr.getResults().createIndexedTupleSource(); } else if (cd.getInvalidation() == Invalidation.IMMEDIATE) { workItem.getRsCache().remove(cid, CachingTupleSource.getDeterminismLevel(cd.getScope()));
boolean readAll = true; synchronized (cd) { readAll = !Boolean.FALSE.equals(cd.getReadAll());
response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope());
CacheDirective cd = new CacheDirective(); this.connectorManager.cacheDirective = cd; helpSetupDataTierManager(); cd.setInvalidation(Invalidation.IMMEDIATE); rrp = new RegisterRequestParameter(); rrp.connectorBindingId = "x";
@Test public void testCancelWithCaching() throws Exception { QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached(); CacheDirective cd = new CacheDirective(); this.connectorManager.cacheDirective = cd; helpSetupDataTierManager(); Command command = helpSetupRequest("SELECT stringkey from bqt1.smalla", 1, metadata).getCommand(); this.context.getSession().setSessionId("different"); RegisterRequestParameter rrp = new RegisterRequestParameter(); rrp.connectorBindingId = "x"; TupleSource ts = dtm.registerRequest(context, command, "foo", rrp); assertTrue(ts instanceof CachingTupleSource); assertEquals(4, pullTuples(ts, 4)); ((CachingTupleSource)ts).item.requestCancel(""); assertEquals(1, connectorManager.getExecuteCount().get()); assertFalse(rrp.doNotCache); ts.closeSource(); //should force read all assertFalse(((CachingTupleSource)ts).dtts.errored); assertNull(((CachingTupleSource)ts).dtts.scope); assertEquals(0, this.rm.getRsCache().getCachePutCount()); }
if (cd.getScope() == Scope.NONE) { parameterObject.doNotCache = true; } else { cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) { CachedResults cr = workItem.getRsCache().get(cid); if (cr != null && (cr.getRowLimit() == 0 || (parameterObject.limit > 0 && cr.getRowLimit() >= parameterObject.limit))) { return cr.getResults().createIndexedTupleSource(); } else if (cd.getInvalidation() == Invalidation.IMMEDIATE) { workItem.getRsCache().remove(cid, CachingTupleSource.getDeterminismLevel(cd.getScope()));
boolean readAll = true; synchronized (cd) { readAll = !Boolean.FALSE.equals(cd.getReadAll());
response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope());
if (!Boolean.FALSE.equals(cd.getUpdatable())) { if (accessedGroups != null) { for (GroupSymbol gs : accessedGroups) { cr.setRowLimit(rowNumber); tb.setPrefersMemory(Boolean.TRUE.equals(cd.getPrefersMemory())); Determinism determinismLevel = getDeterminismLevel(this.dtts.scope); this.dataTierManagerImpl.requestMgr.getRsCache().put(cid, determinismLevel, cr, cd.getTtl()); tb = null;
if (cd.getScope() == Scope.NONE) { parameterObject.doNotCache = true; } else { cid = new CacheID(workItem.getDqpWorkContext(), ParseInfo.DEFAULT_INSTANCE, cmdString); cid.setParameters(cv.parameters); if (cd.getInvalidation() == null || cd.getInvalidation() == Invalidation.NONE) { CachedResults cr = workItem.getRsCache().get(cid); if (cr != null && (cr.getRowLimit() == 0 || (parameterObject.limit > 0 && cr.getRowLimit() >= parameterObject.limit))) { return cr.getResults().createIndexedTupleSource(); } else if (cd.getInvalidation() == Invalidation.IMMEDIATE) { workItem.getRsCache().remove(cid, CachingTupleSource.getDeterminismLevel(cd.getScope()));
boolean readAll = true; synchronized (cd) { readAll = !Boolean.FALSE.equals(cd.getReadAll());
response.setWarnings(this.securityContext.getWarnings()); if (this.securityContext.getCacheDirective() != null) { response.setScope(this.securityContext.getCacheDirective().getScope());
if (!Boolean.FALSE.equals(cd.getUpdatable())) { if (accessedGroups != null) { for (GroupSymbol gs : accessedGroups) { cr.setRowLimit(rowNumber); tb.setPrefersMemory(Boolean.TRUE.equals(cd.getPrefersMemory())); Determinism determinismLevel = getDeterminismLevel(this.dtts.scope); this.dataTierManagerImpl.requestMgr.getRsCache().put(cid, determinismLevel, cr, cd.getTtl()); tb = null;