Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Cache to be an embedded DB #110

Closed
TareqK opened this issue Dec 9, 2021 · 1 comment · Fixed by #113
Closed

Change Cache to be an embedded DB #110

TareqK opened this issue Dec 9, 2021 · 1 comment · Fixed by #113

Comments

@TareqK
Copy link

TareqK commented Dec 9, 2021

Nitrite and Derby come to mind here. The reason for this is not really valid; I just think its cool

@tipsy
Copy link
Owner

tipsy commented Dec 10, 2021

Feel free 😄

tipsy pushed a commit that referenced this issue May 30, 2022
* Make clicking "Unknown" language do nothing.

#97

* Implement user cache using embedded H2.

* Separate caching to its own service

#110

* Change UserProfile to be not Serializable

* Fix copy-paste errors.

* Replace Jackson with Gson which reduced boilerplate code by a bit.

* Introduce an extension function

* Remove unnecessary JsonDeserializer class.

Instead, I decided to use a simple TypeAdapter in order to deserialize number into java.util.Date.

* Switch back to Jackson as deserializer.

* Add warning suppression.

* Replace redundant creation of ObjectMapper.

* Replace LocalDateTime with Instant.

* Prevent multiple invocations of generateUserProfile.

* Cache by lazy.

* Remove unnecessary JSON deserialization from lookUpInCache.

* Prevent NPE.

* Update src/main/kotlin/app/CacheService.kt

Co-authored-by: Sidd <[email protected]>

* Revert "Prevent multiple invocations of generateUserProfile."

This reverts commit 8306d92

* Remove unnecessary custom deserializer.

* Rename function.

UserService#lookUpInCache → selectJsonFromDb

* Reduce invocations of CacheService#selectJsonFromDb.

* Extract functions from duplicate code.

* Update src/main/kotlin/app/CacheService.kt

Co-authored-by: Sidd <[email protected]>

* Remove unnecessary class UserNotLoadableException.

* Remove unnecessary lazy initialization.

* Change id values to lowercase in DB.

follow-up change to 80154a0

* Change data type of `timestamp` from 'TIMESTAMP WITH TIME ZONE' to 'TIMESTAMP'.

* Use HikariCP.

* Update src/main/kotlin/app/util/HikariCpDataSource.kt

Co-authored-by: Sidd <[email protected]>

* Replace string concatenation with multi-line string

* Replace uses of magic numbers

* Remove intermediate local variable

* Make CacheService have `HikariCpDataSource.connection` as its field

Co-authored-by: Sidd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants