-
Notifications
You must be signed in to change notification settings - Fork 56
Add caching + defer the service provider #13
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
cache the password list for future re-use so it doesn’t need to be re-computed every time
src/DumbPasswordServiceProvider.php
Outdated
Validator::extend('dumbpwd', function ($attribute, $value, $parameters, $validator) { | ||
$path = realpath(__DIR__ . '/../resources/config/passwordlist.txt'); | ||
$cache_key = md5_file($path); | ||
$data = Cache::rememberForever('dumbpwd_list_' . $cache_key, function () use ($path) { |
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.
Where is the Cache Facade being imported? or would you rather use the cache helper function?
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.
oops. i had added it in the project I tested this in, but not the fresh clone of the repo. fix incoming!
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.
thanks for catching it
@jkudish Thanks for the PR. This is beautiful. Merging right away!! |
Awesome. Thanks!
…On Tue, Apr 25, 2017, 9:22 PM Prosper Otemuyiwa ***@***.***> wrote:
Merged #13 <#13>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAP4nVAKKbwggGbyEv9rFjH69DaavhZtks5rzsZ2gaJpZM4NILDa>
.
|
@jkudish What's your twitter handle? I want to praise you there 😄 |
I think you found it! 👍 Thanks for the speedy release |
This builds upon #12 to further improve the performance of this service provider:
rememberForever
and an md5 hash of the file as the key, so that the file doesn't need to be re-read and re-computed every time.Let me know what you think 👍