-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement USD Redis Repository (cache) #58
Conversation
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@types/[email protected] |
import fp from "fastify-plugin"; | ||
import { redis } from '../connections/redis'; | ||
import fp from 'fastify-plugin'; | ||
import { redisClient } from '@cowprotocol/repositories'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis client has been moved to the repositories layer
"strict": false, | ||
"strictNullChecks": false, | ||
"alwaysStrict": false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have energy now to solve twap project, so its the only one in non-strict mode
@@ -0,0 +1,274 @@ | |||
import { UsdRepositoryRedis } from './UsdRepositoryRedis'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test for the new repository
const NULL_VALUE = 'null'; | ||
|
||
@injectable() | ||
export class UsdRepositoryRedis implements UsdRepository { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Main contribution of this PR, to create this redis repository
README.md
Outdated
nx run repositories:test --watch | ||
|
||
# Run test on specific file | ||
nx run repositories:test --watch --testFile=libs/repositories/src/UsdRepository/UsdRepositoryRedis.spec.ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why default the test with --watch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, I didn't add it as default, I just gave 3 representative examples. One runs all tests and finishes, another runs the test in watch mode for repository layer, last does the same for a specific file.
I consider this notes just hints for devs on somehing I found useful for myself
I will add some additional text in the comment to clarify
Co-authored-by: Leandro <[email protected]>
Merging to consolidate, I will address any further comment as follow up |
This PR implements a new repository that will allow the cache of the results from other USD Repositories.
This new repo can be configured with a Redis client instance and the proxied repository.
It will cache both values and their absence.
To review this PR you can see the tests. The are written using GIVEN/WHEN/THEN, so they should explain the specification of this new repo.
Bonus
In this PR in also did some other things maybe not super related to the goal of the PR