-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simplified configuration, moved key mgmt to ResultSetCache
- Loading branch information
Julien Ruaux
committed
Jul 2, 2022
1 parent
dc779d7
commit b48bcc0
Showing
19 changed files
with
496 additions
and
624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
core/redis-sidecar-jdbc/src/main/java/com/redis/sidecar/config/ByteSize.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.redis.sidecar.config; | ||
|
||
public class ByteSize { | ||
|
||
private static final int KB = 1024; | ||
private static final int MB = KB * KB; | ||
|
||
private final int bytes; | ||
|
||
private ByteSize(int bytes) { | ||
this.bytes = bytes; | ||
} | ||
|
||
public int toBytes() { | ||
return bytes; | ||
} | ||
|
||
public static ByteSize ofMB(int number) { | ||
return new ByteSize(number * MB); | ||
} | ||
|
||
public static ByteSize ofKB(int number) { | ||
return new ByteSize(number * KB); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
core/redis-sidecar-jdbc/src/main/java/com/redis/sidecar/config/Config.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.redis.sidecar.config; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class Config { | ||
|
||
public static final ByteSize DEFAULT_BUFFER_SIZE = ByteSize.ofMB(100); | ||
public static final long TTL_NO_CACHE = 0; | ||
public static final long TTL_NO_EXPIRATION = -1; | ||
|
||
private int bufferSize = DEFAULT_BUFFER_SIZE.toBytes(); | ||
private List<Rule> rules = Arrays.asList(Rule.builder().build()); | ||
private Pool pool = new Pool(); | ||
|
||
public Pool getPool() { | ||
return pool; | ||
} | ||
|
||
public void setPool(Pool pool) { | ||
this.pool = pool; | ||
} | ||
|
||
public int getBufferSize() { | ||
return bufferSize; | ||
} | ||
|
||
public void setBufferSize(int bufferSize) { | ||
this.bufferSize = bufferSize; | ||
} | ||
|
||
public List<Rule> getRules() { | ||
return rules; | ||
} | ||
|
||
public void setRules(List<Rule> rules) { | ||
this.rules = rules; | ||
} | ||
|
||
} |
Oops, something went wrong.