-
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: Introduced hashing function
- Loading branch information
Julien Ruaux
committed
Feb 24, 2023
1 parent
9045c8e
commit d690fe0
Showing
9 changed files
with
85 additions
and
76 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
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
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
18 changes: 18 additions & 0 deletions
18
...s-smart-cache-jdbc/src/main/java/com/redis/smartcache/core/util/CRC32HashingFunction.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,18 @@ | ||
package com.redis.smartcache.core.util; | ||
|
||
import java.nio.charset.Charset; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.zip.CRC32; | ||
|
||
public class CRC32HashingFunction implements HashingFunction { | ||
|
||
private static final Charset CHARSET = StandardCharsets.UTF_8; | ||
|
||
@Override | ||
public String hash(String string) { | ||
CRC32 crc = new CRC32(); | ||
crc.update(string.getBytes(CHARSET)); | ||
return String.valueOf(crc.getValue()); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
.../redis-smart-cache-jdbc/src/main/java/com/redis/smartcache/core/util/HashingFunction.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,7 @@ | ||
package com.redis.smartcache.core.util; | ||
|
||
public interface HashingFunction { | ||
|
||
String hash(String string); | ||
|
||
} |
29 changes: 20 additions & 9 deletions
29
...redis/smartcache/core/TableExtractor.java → ...redis/smartcache/core/util/SQLParser.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
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
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
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