Skip to content

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

Merged
merged 7 commits into from
Jul 29, 2016
Merged

Conversation

WyriHaximus
Copy link
Member

@WyriHaximus WyriHaximus commented Jun 1, 2016

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:

  • Implement cache adapter injection
  • Tests
  • Documentation

@WyriHaximus
Copy link
Member Author

@cboden @clue please let me know if you 👍 this idea, if so I'll add the tests and documentation

@clue
Copy link
Member

clue commented Jun 1, 2016

I think this makes sense 👍

@WyriHaximus
Copy link
Member Author

I think this makes sense 👍

Cheers! Does the way I've implemented it also makes sense?

@clue
Copy link
Member

clue commented Jun 1, 2016

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 👍

@WyriHaximus
Copy link
Member Author

Absolutely! I'm not a huge fan of the given design, but despite a lack of documentation this LGTM 👍

Cheers, I'll add the tests and documentation soon

@WyriHaximus
Copy link
Member Author

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.
Copy link
Member

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).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@clue
Copy link
Member

clue commented Jun 4, 2016

LGTM 👍

@WyriHaximus
Copy link
Member Author

Great! :shipit:

@WyriHaximus
Copy link
Member Author

Could anyone else 👎 or 👍 this so it can be merged and tagged? Could use that :)

@clue
Copy link
Member

clue commented Jul 29, 2016

Let's get this in! :shipit:

@clue clue merged commit 5fdf770 into reactphp:master Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy