Skip to content

[5.8] Add underscores to cache and redis database prefixes #4986

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 2 commits into from
Apr 8, 2019
Merged

[5.8] Add underscores to cache and redis database prefixes #4986

merged 2 commits into from
Apr 8, 2019

Conversation

DivineOmega
Copy link
Contributor

This PR adds an additional underscore to the end of the generated cache prefix and redis database prefix.

Addresses the relevant points regarding poorly named keys, mentioned by @fitztrev @ludo237 @gerardnll in #4982.

@driesvints driesvints changed the title Add underscores to cache and redis database prefixes [5.8] Add underscores to cache and redis database prefixes Apr 8, 2019
@gerardnll
Copy link

gerardnll commented Apr 8, 2019

Adding an underscore to cache prefix will create keys like this: local_database_local_cache_:<key>. I would just add ':' to config/database.php prefix so keys will look like local_database:local_cache:<key>.

Also, why not laravel_database:laravel_cache:<key> instead?

@taylorotwell taylorotwell merged commit 005ec13 into laravel:master Apr 8, 2019
@DivineOmega
Copy link
Contributor Author

DivineOmega commented Apr 8, 2019

@gerardnll We need to use a suffix that all potential cache systems definitely support. I would imagine underscore is far more supported than a colon may be, especially if you consider file system based caches.

@DivineOmega
Copy link
Contributor Author

Thanks for merging @taylorotwell. 👍

@ludo237
Copy link

ludo237 commented Apr 8, 2019

@gerardnll I don't want to be that guy but as always: those files are editable by the dev-team after all, so it's up to them.

The new part of this merge, and the previous one, is the exposure of the prefix option which is huge imo

@gerardnll
Copy link

gerardnll commented Apr 8, 2019

@gerardnll I don't want to be that guy but as always: those files are editable by the dev-team after all, so it's up to them.

The new part of this merge, and the previous one, is the exposure of the prefix option which is huge imo

Yep, I'll just overwrite that config var.

@gerardnll We need to use a suffix that all potential cache systems definitely support. I would imagine underscore is far more supported than a colon may be, especially if you consider file system based caches.

Only Redis, Memcached, database and Dynamo and APC use prefixes.

@fitztrev
Copy link

fitztrev commented Apr 8, 2019

The cache one should not be appended with the underscore. Those keys are now:

laravel_database_laravel_cache_:<key>

@gerardnll
Copy link

The cache one should not be appended with the underscore. Those keys are now:

laravel_database_laravel_cache_:<key>

Yes, that's what I was pointing out in my first comment...

@fitztrev
Copy link

fitztrev commented Apr 8, 2019

@DivineOmega was there a reason you changed the cache prefix config?

realodix added a commit to realodix/urlhub that referenced this pull request Apr 8, 2019
realodix added a commit to realodix/urlhub that referenced this pull request Apr 8, 2019
@DivineOmega
Copy link
Contributor Author

@fitztrev I was not aware that the cache key prefix had a : automatically appending to it.

@DivineOmega
Copy link
Contributor Author

@gerardnll We need to use a suffix that all potential cache systems definitely support. I would imagine underscore is far more supported than a colon may be, especially if you consider file system based caches.

Only Redis, Memcached, database and Dynamo and APC use prefixes.

Ah, that makes sense. I wasn't aware the cache prefix was only applied to certain cache drivers..

@DivineOmega DivineOmega deleted the patch-1 branch April 10, 2019 10:54
@gerardnll
Copy link

gerardnll commented Apr 10, 2019 via email

@DivineOmega
Copy link
Contributor Author

@gerardnll I'm on it. :)

@DivineOmega
Copy link
Contributor Author

@fitztrev @gerardnll PR to remove the underscore from the cache prefix is here: #4987.

@anasbouzid
Copy link

I think laravel:cache:<key> is a better naming convention. As discussed above, I see no reason not to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants