aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/cache/behaviors/cache_store_behavior.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Preserve key order passed to ActiveSupport::CacheStore#fetch_multiGannon McGibbon2018-12-271-1/+9
| | | | | | fetch_multi(*names) now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
* Array with single item correctly uses cache_keyGraham Turner2018-10-051-0/+49
|
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-2/+2
|
* Enable `Performance/UnfreezeString` copyuuji.yaginuma2018-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Ruby 2.3 or later, `String#+@` is available and `+@` is faster than `dup`. ```ruby # frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "benchmark-ips" end Benchmark.ips do |x| x.report('+@') { +"" } x.report('dup') { "".dup } x.compare! end ``` ``` $ ruby -v benchmark.rb ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] Warming up -------------------------------------- +@ 282.289k i/100ms dup 187.638k i/100ms Calculating ------------------------------------- +@ 6.775M (± 3.6%) i/s - 33.875M in 5.006253s dup 3.320M (± 2.2%) i/s - 16.700M in 5.032125s Comparison: +@: 6775299.3 i/s dup: 3320400.7 i/s - 2.04x slower ```
* Fix the obvious typos detected by github.com/client9/misspellKazuhiro Sera2018-08-081-1/+1
|
* Support skip nil for cache fetch (#25437)Martin2018-08-051-0/+7
| | | | | | | | | | | | * test case for fetch cache miss with skip_nil * abondon nil cache if skip_nil specified * ensure not cache key for skip nil * add document with skip_nil for Store#fetch * add a new change log entry for #25437
* Allow rubocop check more filesbogdanvlviv2018-04-191-2/+2
| | | | | | | | | This commit fix pattern of filenames for `CustomCops/AssertNot` and `CustomCops/RefuteNot`. rubocop should check every file under `test/`. Related to #32441, #32605
* 2.6 warning: passing splat keyword arguments as a single Hashutilum2018-04-151-2/+2
| | | | | | | | | | | | Ruby 2.6.0 warns about this. ``` ruby -v ruby 2.6.0dev (2018-04-04 trunk 63085) [x86_64-linux] ``` Before, see: https://travis-ci.org/rails/rails/jobs/365740163#L1262-L1264 https://travis-ci.org/rails/rails/jobs/365944863#L2121-L2174
* Use `SecureRandom.random_bytes` instead of `SecureRandom.bytes`yuuji.yaginuma2018-04-131-1/+1
| | | | | | | | | | `SecureRandom.byes` was added in Ruby 2.4. So, 5-2-stable build is broken because using `SecureRandom.bytes`. https://travis-ci.org/rails/rails/jobs/365740667 Also, `SecureRandom.byes` seems to an undocumented method. If need random binary strings, should use `SecureRandom.random_bytes`. https://github.com/ruby/ruby/blob/trunk/lib/securerandom.rb
* Fix `ActiveSupport::Cache` compressionGodfrey Chan2018-04-111-2/+21
| | | | (See previous commit for a description of the issue)
* Add failing test for compression bugGodfrey Chan2018-04-111-15/+115
| | | | | | | | | | | | | On Rails 5.2, when compression is enabled (which it is by default), the actual value being written to the underlying storage is actually _bigger_ than the uncompressed raw value. This is because the `@marshaled_value` instance variable (typically) gets serialized with the entry object, which is then written to the underlying storage, essentially double-storing every value (once uncompressed, once possibly compressed). This regression was introduced in #32254.
* RedisCacheStore: fix `#write_multi` mset serializationfatkodima2018-02-041-0/+10
| | | | | Closes #31886 Fixes #31884
* Fix constant referenceGeorge Claghorn2018-01-161-2/+1
| | | | Update the long key handling test so it triggers truncation in the Redis cache store.
* Test that cache stores build unversioned keysGeorge Claghorn2017-12-221-0/+12
|
* Cache: Enable compression by default for values > 1kB.Jeremy Daer2017-11-131-0/+10
| | | | | | | | | | | | | Compression has long been available, but opt-in and at a 16kB threshold. It wasn't enabled by default due to CPU cost. Today it's cheap and typical cache data is eminently compressible, such as HTML or JSON fragments. Compression dramatically reduces Memcached/Redis mem usage, which means the same cache servers can store more data, which means higher hit rates. To disable compression, pass `compress: false` to the initializer.
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActiveSupport frozen string literal friendly.Pat Allan2017-06-201-2/+2
|/ | | | | | | The ActiveSupport test suite only passes currently if it uses the latest unreleased commits for dalli, and a patch for Builder: https://github.com/tenderlove/builder/pull/6 Beyond that, all external dependencies (at least, to the extent they’re used by ActiveSupport) are happy, including Nokogiri as of 1.8.0.
* Split up the cache test suite so it's easier to understand and extend (#29404)Jeremy Daer2017-06-101-0/+329
Split up the caching tests as prep for adding a new cache store. Slices the mega test/caching_test.rb into behavior modules, concrete store tests, and cross-cutting store tests. Considering moving cache store behavior modules into lib/ so they may be used for acceptance testing by third parties.