-
-
Notifications
You must be signed in to change notification settings - Fork 60
Allow for cache adapter injection #38
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
Conversation
I think this makes sense 👍 |
Cheers! Does the way I've implemented it also makes sense? |
Absolutely! I'm not a huge fan of the given design, but despite a lack of documentation/tests this LGTM 👍 |
Cheers, I'll add the tests and documentation soon |
Documentation and test added, also updated the other cache test to ensure default behavior isn't affected |
@@ -53,6 +53,17 @@ $loop->run(); | |||
If the first call returns before the second, only one query will be executed. | |||
The second result will be served from cache. | |||
|
|||
### Custom cache adapter | |||
|
|||
You can also specify a cache that [implements](https://github.com/reactphp/react/wiki/Users#cache-implementations) [`CacheInterface`](https://github.com/reactphp/cache) to handle the record cache instead of the default in memory cache. |
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.
Perhaps we can make this a bit more explicit:
By default, the above will use an in memory cache.
You can also specify a custom cache implementing [`CacheInterface`](https://github.com/reactphp/cache) to handle the record cache instead:
[…]
See also the wiki for possible [cache implementations](https://github.com/reactphp/react/wiki/Users#cache-implementations).
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.
Done 👍
LGTM 👍 |
Great! |
Could anyone else 👎 or 👍 this so it can be merged and tagged? Could use that :) |
Let's get this in! |
While developing wyrihaximus/react-cache-redis I've noticed that passing your own cache implementation into the resolver is suboptimal compared to the proposed change.
To do: