Skip to content

Commit

Permalink
changes execution time to int
Browse files Browse the repository at this point in the history
  • Loading branch information
antleb committed Feb 17, 2024
1 parent 5dde48f commit 572f06b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public class CacheEntry {

private String profile;

private long execTime;
private int execTime;

public CacheEntry(String key, QueryWithParameters query, Result result) {
this.key = key;
this.query = query;
this.result = result;
}

public CacheEntry(String key, QueryWithParameters query, Result result, long execTime) {
public CacheEntry(String key, QueryWithParameters query, Result result, int execTime) {
this.key = key;
this.query = query;
this.result = result;
Expand Down Expand Up @@ -105,11 +105,11 @@ public void setPinned(boolean pinned) {
this.pinned = pinned;
}

public long getExecTime() {
public int getExecTime() {
return execTime;
}

public void setExecTime(long execTime) {
public void setExecTime(int execTime) {
this.execTime = execTime;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static String getCacheKey(QueryWithParameters query) throws Exception {

Result get(String key) throws Exception;

void save(QueryWithParameters fullSqlQuery, Result result, long execTime) throws Exception;
void save(QueryWithParameters fullSqlQuery, Result result, int execTime) throws Exception;

void storeEntry(CacheEntry entry) throws Exception;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void dropCache() throws Exception {
}

@Override
public void save(QueryWithParameters fullSqlQuery, Result result, long execTime) throws Exception {
public void save(QueryWithParameters fullSqlQuery, Result result, int execTime) throws Exception {
DatasourceContext.setContext(CACHE_DB_NAME);
try {
String key = StatsCache.getCacheKey(fullSqlQuery);
Expand Down Expand Up @@ -177,7 +177,7 @@ public List<CacheEntry> getEntries() {
entry.setTotalHits(rs.getInt("total_hits"));
entry.setSessionHits(rs.getInt("session_hits"));
entry.setPinned(rs.getBoolean("pinned"));
entry.setExecTime(rs.getLong("exectime"));
entry.setExecTime(rs.getInt("exectime"));
entry.setProfile(rs.getString("profile"));
} catch (IOException e) {
log.error("Error reading entry", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Result get(String key) throws RedisException {
}

@Override
public void save(QueryWithParameters fullSqlQuery, Result result, long execTime) throws RedisException {
public void save(QueryWithParameters fullSqlQuery, Result result, int execTime) throws RedisException {

try {
String key = StatsCache.getCacheKey(fullSqlQuery);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void doUpdateCache() {
long execTime = new Date().getTime() - start;

entry.setShadowResult(shadow);
entry.setExecTime(execTime);
entry.setExecTime((int) execTime);
} else {
log.info("time or # of queries limits exceeded. Invalidating entry " + entry.getKey());

Expand Down

0 comments on commit 572f06b

Please sign in to comment.