-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Redis configuration provider #215
Open
apemaia99
wants to merge
16
commits into
vapor:main
Choose a base branch
from
apemaia99:redisConfigurationProvider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
R moved RedisStorage bootstrap implementation to RedisProvider concrete implementation
R added file for redisConnectionPool utils extension
… used from RedisStorage on bootstrap F added computed property in order to retrieve factory based on current configuration
…eate new clients delegating creation to the factory R redisStorage now holds a dictionary of RedisClient interfaces instead of RedisConnectionPool (that unfortunately is not an interface) . This allows mocking Vapor.Redis entirely. This has the cons that in some cases we should downcast in order to perform specific operations: pool.close on shutdown, withBorrowedConnection feature. F added Application.Redis.Errors enum to hold errors
F added factory as additional optional parameter with default fallback on internal standard RedisProvider
F RedisConfiguration conforms to redisFactory F added use method like other vapor services & removed redis.configuration
F added redisConfigurationFactory that allows to store a configuration for later client creation F redisConfigurationFactory has a list of static method replacing old RedisConfiguration initializers, this is essential in order allow discovery on redis.use(...) R changed type on redisStorage
R separated content of redisStorage in multiple files and placed under its folder
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Redis
RedisFactory
is a protocol that defines how to produceRedisClient
s.RedisConfigurationFactory
is an abstract factory that produceRedisConfiguration
s, and provides several methods that replaces allRedisConfiguration
constructors. This breaks current APIstry app.redis(.one).use(.standalone(hostname: "an-hostname", port: 6379, pool: .init(connectionRetryTimeout: .milliseconds(100))))
like we already do in Fluent.RedisConfiguration
conforms toRedisFactory
and actually creates RedisClients where previously were done inRedisStorage.LifeCycle
.RedisStorage
now storesRedisClient
instead ofRedisConnectionPool
.func withBorrowedConnection
is by down castingRedisClient
toRedisConnectionPool
withas?
operator or an error will be trowed.XCTRedis
similarly toXCTFluent
XCTRedis
This product allows to stub responses of redis, also for PubSub in order to test applications without conditions in production code to exclude redis. Writing code for test is not the way.
ArrayTestRedisClient
is a stub class for storing & manipulating responses.ArrayTestDatabase
DummyRedis
is the actualRedisClient
stored inRedisStorage
during tests.ArrayTestRedisClient
RedisStub
is the actual factory to be used in tests.app.redis(.one).use(.stub(client: client))
Redis configuration provider + XCTRedis