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 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 added the activesupport label Jun 6, 2017
@jeremy jeremy changed the title Cache: `write_multi` Cache: write_multi Jun 6, 2017
activesupport/lib/active_support/cache.rb Outdated
@@ -521,6 +535,14 @@ def write_entry(key, entry, options)
raise NotImplementedError.new
end

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

This comment has been minimized.

Copy link
@robin850

robin850 Jun 6, 2017

Member

"Writes several entries to the cache implementation" ?

@jeremy jeremy force-pushed the jeremy:cache-write-multi branch 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 force-pushed the jeremy:cache-write-multi branch to f9007b6 Jun 6, 2017
@jeremy jeremy merged commit 2b96d58 into rails:master Jun 6, 2017
2 checks passed
2 checks passed
codeclimate no new or fixed issues
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jeremy jeremy deleted the jeremy: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
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.