Skip to content
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

Cache: write_multi #29366

Merged
merged 1 commit into from Jun 6, 2017
Merged

Cache: write_multi #29366

merged 1 commit into from Jun 6, 2017

Conversation

jeremy
Copy link
Member

@jeremy jeremy commented Jun 6, 2017

Rails.cache.write_multi foo: 'bar', baz: 'qux'

Plus faster fetch_multi with stores that implement write_multi_entries.
Keys that aren't found may be written to the cache store in one shot
instead of separate writes.

The default implementation simply calls write_entry for each entry.
Stores may override if they're capable of one-shot bulk writes, like
Redis MSET.

@jeremy jeremy changed the title Cache: write_multi Cache: write_multi Jun 6, 2017
@@ -521,6 +535,14 @@ def write_entry(key, entry, options)
raise NotImplementedError.new
end

# Writes an entry to the cache implementation. Subclasses MAY implement
Copy link
Member

@robin850 robin850 Jun 6, 2017

Choose a reason for hiding this comment

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

"Writes several entries to the cache implementation" ?

    Rails.cache.write_multi foo: 'bar', baz: 'qux'

Plus faster `fetch_multi` with stores that implement `write_multi_entries`.
Keys that aren't found may be written to the cache store in one shot
instead of separate writes.

The default implementation simply calls `write_entry` for each entry.
Stores may override if they're capable of one-shot bulk writes, like
Redis `MSET`.
@jeremy jeremy merged commit 2b96d58 into rails:master Jun 6, 2017
@jeremy jeremy deleted the cache-write-multi branch Jun 6, 2017
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.

None yet

2 participants