Cache: write_multi #29366

Merged
merged 1 commit into from Jun 6, 2017

Conversation

Projects
None yet
2 participants
@jeremy
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 from Cache: `write_multi` to 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

This comment has been minimized.

@robin850

robin850 Jun 6, 2017

Member

"Writes several entries to the cache implementation" ?

@robin850

robin850 Jun 6, 2017

Member

"Writes several entries to the cache implementation" ?

Cache: write_multi
    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

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