aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/caching_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Check by @v before converting the entry on expired?Rafael Mendonça França2015-01-011-1/+1
| | | | | | | We should convert when @v is defined not @value. The test was calling value first that already converts the entry so we are not catching this bug.
* Keep the first string we fetchMatthew Draper2014-08-271-1/+1
| | | | Otherwise, it's possible for GC to run in between, and fail the test.
* Create with_env helper for tests.Zuhao Wan2014-06-221-14/+13
|
* fix error with long keys in ActiveSupport::Cache::FileStoreAdam Panzer2014-06-101-0/+5
|
* Return a hash rather than array from fetch_multiParker Selbert2014-02-261-8/+9
| | | | | | | The current implementation of `fetch_multi` returns an array and has no means to easily backtrack which names yielded which results. By changing the return value to a Hash we retain the name information. Hash#values can be used on the response if only the values are needed.
* clear cache on body close so that cache remains during renderingAaron Patterson2014-01-081-0/+37
| | | | | | | | fixes #13547 The body may use the local cache during rendering. `call`ing the app doesn't mean that rendering is finished, so we need to wait until `close` is called on the body.
* Raise if MemCacheStore doenst receive a Dalli objArthur Neves2014-01-031-0/+8
| | | | | | :mem_cache_store should receive a list of hosts or a dalli client, otherwise raise it. Also adding a changelog.
* mem_cache_store requires dalli, so only accept dalli/clientArthur Neves2014-01-031-8/+0
| | | | | | | :mem_cache_store require dalli, rescue Dalli exceptions, and follow Dalli API. Memcached gem, for instance, doesnt work anymore, as the API are different. As we already require one client, we should make sure that client works, and not accept others, and if someone wants to use another memcache client they can write their own store adapter.
* Merge pull request #11785 from grosser/grosser/file-unless-existRafael Mendonça França2013-10-281-0/+7
|\ | | | | | | | | | | | | | | support :unless_exist for FileCache Conflicts: activesupport/CHANGELOG.md activesupport/test/caching_test.rb
| * support :unless_exist for FileCachegrosser2013-08-301-0/+7
| |
* | Fix FileStore#cleanup to no longer rely on missing each_key methodMurray Steele2013-09-111-0/+12
|/
* [Fixes #11512] improves cache size calculation in ↵Simeon Simeonov2013-07-221-2/+26
| | | | | | | | | | | | | | | | | | | | | ActiveSupport::Cache::MemoryStore Previously, the cache size of `ActiveSupport::Cache::MemoryStore` was calculated as the sum of the size of its entries, ignoring the size of keys and any data structure overhead. This could lead to the calculated cache size sometimes being 10-100x smaller than the memory used, e.g., in the case of small values. The size of a key/entry pair is now calculated via `#cached_size`: def cached_size(key, entry) key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD end The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on 1.9.3 and 2.0. Fixes GH#11512 https://github.com/rails/rails/issues/11512
* Explicitly test for true and false.Jade Tucker2013-07-071-2/+2
|
* Allow fetching multiple values from the cache at onceDaniel Schierbeck2013-05-061-0/+20
| | | | | Add a simple API for fetching a list of entries from the cache, where any missing entries are computed by a supplied block.
* switch (and lazily convert) ivar names to 3.xSam Ruby2013-04-161-16/+15
|
* Fixed typoAnupam Choudhury2013-04-101-1/+1
|
* Fix typo in DependenciesTestHelpers module nameVipul A M2013-03-121-2/+2
|
* Fix deletion of empty directories:Charles Jones2013-02-251-0/+12
| | | | | | | | | | | | | | | 1. When comparing the directory to delete against the top level cache_path, use File.realpath to make sure we aren't comparing two unequal strings that point to the same path. This occurs, for example, when cache_path has a trailing slash, which it does in the default Rails configuration. Since the input to delete_empty_directories never has a trailing slash, the comparison will never be true and the top level cache directory (and above) may be deleted. However… 2. File.delete raises EPERM when trying to delete a directory, so no directories have ever been deleted. Changing the code to Dir.delete fixes that.