Skip to content

send normalized keys to the cache backends so they do not need to man… - #22215

Merged
rafaelfranca merged 2 commits into
rails:masterfrom
grosser:grosser/normalize_key
Nov 16, 2015
Merged

rafaelfranca merged 2 commits into
rails:masterfrom
grosser:grosser/normalize_key

Conversation

@grosser

@grosser grosser commented Nov 7, 2015

Copy link
Copy Markdown
Contributor

…age this themselves

key manipulation is a recurring pattern in the cache stores (base + file + mem_cached) which makes the code less readable and mixes concerns

this moves all the key manipulation into a single method normalize_key and reuses that, which will also enable users to inherit or share logic better via modules since they no longer have to modify the key (escape_key or key_file_path or namespaced_key)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

cleaning this up ... passes amount but it is not being used ...

@grosser

grosser commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

@kaspth another one ... this did not get assigned to anyone ...

@jeremy

jeremy commented Nov 10, 2015

Copy link
Copy Markdown
Member

API changes break any non-core cache store subclasses that override or call these methods.

@grosser

grosser commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

so leave the method as namespaced_key so nobody that calls super gets hurt ?

@jeremy

jeremy commented Nov 10, 2015

Copy link
Copy Markdown
Member

And the callers of any of the methods that now require a namespaced/normalized key argument.

@grosser

grosser commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

Only private methods were changes, so this would only affect
users that do Rails.cache.send(:read_entry) ...

On Mon, Nov 9, 2015 at 8:51 PM, Jeremy Daer notifications@github.com
wrote:

And the callers of any of the methods that now require a
namespaced/normalized key argument.


Reply to this email directly or view it on GitHub
#22215 (comment).

@jeremy

jeremy commented Nov 10, 2015

Copy link
Copy Markdown
Member

The consumers of these API are other cache store subclasses. They call or super() to these boilerplate methods.

@grosser

grosser commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

so they would still work fine when renamed to normalize_parameters, right ?

@grosser

grosser commented Nov 10, 2015

Copy link
Copy Markdown
Contributor Author

I added an alias for the old method, so there should be no fallout ... good to go ?

@grosser
grosser force-pushed the grosser/normalize_key branch from 2dbefd8 to 282be24 Compare November 11, 2015 05:13
@grosser

grosser commented Nov 11, 2015

Copy link
Copy Markdown
Contributor Author

rebased

@jeremy looking good ?

@grosser
grosser force-pushed the grosser/normalize_key branch from 282be24 to f6bc5ac Compare November 11, 2015 05:17
@grosser

grosser commented Nov 12, 2015

Copy link
Copy Markdown
Contributor Author

@rafaelfranca got 2 cents on that ?

@grosser

grosser commented Nov 16, 2015

Copy link
Copy Markdown
Contributor Author

@jeremy / @kaspth / @rafaelfranca ok to merge this ?

@rafaelfranca

Copy link
Copy Markdown
Member

The API is being maintained by the alias so I think it is good. Thanks

rafaelfranca added a commit that referenced this pull request Nov 16, 2015
send normalized keys to the cache backends so they do not need to man…
@rafaelfranca
rafaelfranca merged commit b58c37e into rails:master Nov 16, 2015

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't cover backwards compatibility. The file and mem cache stores changes break user written subclasses.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

user written subclasses of stores, not Cache itself, right ?

@kaspth

kaspth commented Nov 18, 2015

Copy link
Copy Markdown
Contributor

Missed the conversation going on in #22205 (comment). Backing off 🤘

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.

4 participants