aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-0/+90
|
* Don't cache locally if unless_exist was passedEugene Kenny2017-05-141-0/+8
| | | | | | | | | | Some cache backends support the `unless_exist` option, which tells them not to overwrite an existing entry. The local cache currently always stores the new value, even though the backend may have rejected it. Since we can't tell which value will end up in the backend cache, we should delete the key from the local cache, so that the next read for that key will go to the backend and pick up the correct value.
* Make sure local cache cleared even it's throwing:Lin Jen-Shin2017-03-101-0/+11
| | | | | | | | | | | | | | | | | | | | | | We (GitLab) hit into an issue that somewhere in the middleware chain was throwing `:warden`, which was caught in the wrapping middleware, but `LocalCache::Middleware` was not aware of it. It should look like: ``` ruby result = catch(:warden) do @app.call(env) end ``` Source: https://github.com/hassox/warden/blob/090ed153dbd2f5bf4a1ca672b3018877e21223a4/lib/warden/manager.rb#L35-L37 Using `ensure` could make sure that we would always do the cleanup, and better yet, avoid `rescue Exception` which we all should know that could cause some issues which could be very hard to debug. Please check the discussion thread for more context: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/1402#note_25128108
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-5/+5
|
* fix new warning in ruby 2.4yuuji.yaginuma2016-12-141-1/+1
| | | | | | | | | | | | | | This fixes the following warning. ``` test/caching_test.rb:986: warning: parentheses after method name is interpreted as test/caching_test.rb:986: warning: an argument list, not a decomposed argument test/cases/adapters/mysql2/reserved_word_test.rb:146: warning: parentheses after method name is interpreted as test/cases/adapters/mysql2/reserved_word_test.rb:146: warning: an argument list, not a decomposed argument ``` Ref: https://github.com/ruby/ruby/commit/65e27c8b138d6959608658ffce2fa761842b8d24
* Remove deprecated namespaced_keyAndrew White2016-11-131-6/+0
|
* Remove deprecated set_cache_valueAndrew White2016-11-131-9/+0
|
* Remove deprecated escape_keyAndrew White2016-11-131-6/+0
|
* Remove deprecated key_file_pathAndrew White2016-11-131-6/+0
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* add check of argumentyuuji.yaginuma2016-09-171-0/+6
| | | | | | | `#fetch_multi` in case did not cache hit, to write a cache using the block value. https://github.com/rails/rails/blob/master/activesupport/lib/active_support/cache.rb#L383..L384 Therefore, block is a need to pass always, I think should check first.
* Merge pull request #25863 from mechanicles/remove-duplicate-testRafael França2016-08-161-5/+0
|\ | | | | Remove duplicate test.
| * Remove duplicate test.Santosh Wadghule2016-07-171-5/+0
| | | | | | | | | | We already test similar stuff in `test_really_long_keys` so removing this extra and duplicated test.
* | Add three new rubocop rulesRafael Mendonça França2016-08-161-11/+11
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-061-7/+7
| |
* | remove redundant curlies from hash argumentsXavier Noria2016-08-061-3/+3
| |
* | modernizes hash syntax in activesupportXavier Noria2016-08-061-51/+51
| |
* | applies new string literal convention in activesupport/testXavier Noria2016-08-061-214/+214
| | | | | | | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* | Merge pull request #25823 from mechanicles/missing-memory-store-testsRafael França2016-07-201-0/+10
|\ \ | | | | | | Add missing tests for memory store of cache.
| * | Add missing tests for memory store of cache.Santosh Wadghule2016-07-171-0/+10
| |/
* / Add missing test for clearing up local cache on invalid parameters err.Santosh Wadghule2016-07-171-0/+12
|/ | | | | Add missing test for clearing up local cache and check response should be present on invalid parameters error.
* Pathname might not be always initialized.Vít Ondruch2016-07-071-0/+2
| | | | Require 'pathname' explicitly
* Merge pull request #24577 from mechanicles/fix-fetch-cache-missJeremy Daer2016-04-181-0/+14
|\ | | | | | | Fix forced cache miss for fetch when called without a block.
| * Fix forced cache miss for fetch.Santosh Wadghule2016-04-181-0/+14
|/ | | | | | - Raised an argument error if no block is passed to #fetch with 'force: true' option is set. - Added tests for the same.
* remove args from assert_nothing_raised in testsTara Scherner de la Fuente2016-02-221-2/+2
|
* Revert "Instrument read_multi".Kasper Timm Hansen2016-02-201-9/+0
| | | | | | | | | | | | | | | | | | Reevaluating the log output generated from this instrumentation, we've found that it wasn't all that useful in practice. ``` Caches multi read: - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad ``` If rendering many templates the output is inscrutable, and it's impossible to see how many cache misses there were. Revert ca6aba7f30 and implement a better way later.
* Merge pull request #22278 from poporul/masterGodfrey Chan2016-01-151-3/+5
|\ | | | | Allow to store .keep file in cache directory
| * Allow to store .keep file in cache directoryAlexey Pokhozhaev2015-11-131-3/+5
| |
* | Suppress warning ambiguous first argumentyui-knk2015-12-201-1/+1
| | | | | | | | | | Suppress warning (warning: ambiguous first argument; put parentheses or a space even after `/' operator)
* | Fix cache fetch miss notification orderRobin Clowers2015-12-021-12/+16
| | | | | | | | | | | | | | | | Fixes https://github.com/rails/rails/issues/22477. When I improved the caching instrumentation in edd33c08d98723ae9bb89cf7f019277117ed6414, I inadvertently changed the order of AS notifications when there is a cache miss.
* | add deprecations for a smooth transition after #22215Michael Grosser2015-11-191-0/+27
| |
* | send normalized keys to the cache backends so they do not need to manage ↵Michael Grosser2015-11-101-5/+5
|/ | | | this themselves
* do not override fetch on local cacheMichael Grosser2015-11-071-2/+9
| | | | | | fetch is supposed to behave differently, this was a mistake merged in https://github.com/rails/rails/pull/22194
* Merge pull request #22194 from grosser/grosser/read-nilSean Griffin2015-11-051-0/+8
|\ | | | | cache nil replies from backend cache so misses are fast too
| * cache nil replies from backend cache so misses are fast tooMichael Grosser2015-11-051-0/+8
| |
* | Merge pull request #11872 from AvnerCohen/log_namespaceSean Griffin2015-10-301-0/+13
|\ \ | | | | | | When testing cache issues, it is useful to log the actual key, including namespace
| * | When logging Cache key, in debug mode, also log namespace, to create the ↵Avner Cohen2015-06-231-0/+13
| | | | | | | | | | | | full key that actually used by the underline cache implementation
* | | Merge pull request #19889 from cedrics/long-uri-encoded-keysSean Griffin2015-10-201-0/+5
|\ \ \ | | | | | | | | FileStore: Long cache keys may result in too long paths due to encoding
| * | | when checking for too long cache keys used the uri encoded fname Cedric Sohrauer2015-04-241-0/+5
| | | |
* | | | Add test cases for Cache#fetch instrumentationRobin Clowers2015-09-141-0/+28
| |_|/ |/| |
* | | Removed use of mocha in active_supportRonak Jangir2015-07-101-31/+43
| | |
* | | remove bad test.Aaron Patterson2015-06-251-4/+0
| |/ |/|
* | Removed mocha stubbing in active_supportRonak Jangir2015-06-071-41/+51
| |
* | Avoid E constant clashing with Minitest defined version.Kasper Timm Hansen2015-05-221-8/+8
|/ | | | | Minitest sets an E constant to an empty string to save GC time. This clashes with autoloading tests which define an E constant.
* Allow AS::Cache::FileStore#clear without cache directoryKohei Suzuki2015-04-091-0/+6
| | | | | | Currently `Rails.cache.clear` raises Errno::ENOENT if it's run just after cloning a new Rails project. It should succeed without removing files or directories.
* Skip the `:race_condition_ttl` branch if the option is 0 or nil. This fixes ↵Matt Wilde2015-03-111-8/+20
| | | | an issue with the redis cache, where this code will sometimes throw an error out of SETEX when passing 0 as the `expires_at`.
* Remove not needed .tapArthur Neves2015-03-021-1/+1
|
* Do not output in the consoleRafael Mendonça França2015-03-021-1/+1
| | | | [Robin Dupret + Rafael Mendonça França]
* Instrument read_multi.Kasper Timm Hansen2015-02-211-0/+9
| | | | | | | | | | Adds `read_multi` instrumentation formatted as: Caches multi read: - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/2/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad - views/david/3/4184ab71db6849621a4d8820fcd2c0ad
* Remove conversion code for old Rails cache entryRafael Mendonça França2015-01-011-26/+0
| | | | | | | | | This code was there just to convert entries generated in Rails 4.0.0.beta1 applications to a supported format. It is almost unlikely that any existent application have this cache entry format in their caches at the point that Rails 5 will be released so we don't need this code anymore.