1 22 23 package org.continuent.sequoia.controller.cache.result.entries; 24 25 import java.util.Date ; 26 27 import org.continuent.sequoia.controller.backend.result.ControllerResultSet; 28 import org.continuent.sequoia.controller.requests.SelectRequest; 29 30 37 public class ResultCacheEntryRelaxed extends AbstractResultCacheEntry 38 { 39 private long timeout; 40 private long deadline; 41 private boolean keepIfNotDirty; 42 43 52 public ResultCacheEntryRelaxed(SelectRequest request, 53 ControllerResultSet result, long timeout, boolean keepIfNotDirty) 54 { 55 super(request, result); 56 this.timeout = timeout; 57 this.deadline = System.currentTimeMillis() + timeout; 58 this.keepIfNotDirty = keepIfNotDirty; 59 } 60 61 64 public void invalidate() 65 { 66 state = CACHE_DIRTY; 67 } 68 69 72 public String getType() 73 { 74 return "Relaxed"; 75 } 76 77 82 public long getDeadline() 83 { 84 return deadline; 85 } 86 87 92 public void setDeadline(long deadline) 93 { 94 this.deadline = deadline; 95 } 96 97 102 public long getTimeout() 103 { 104 return timeout; 105 } 106 107 110 public String [] toStringTable() 111 { 112 return new String []{request.getUniqueKey(), getType(), getState(), 113 new Date (getDeadline()).toString(), String.valueOf(getSizeOfResult())}; 114 } 115 116 122 public boolean getKeepIfNotDirty() 123 { 124 return keepIfNotDirty; 125 } 126 127 } | Popular Tags |