aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache
Commit message (Collapse)AuthorAgeFilesLines
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-1/+7
|
* Don't cache locally if unless_exist was passedEugene Kenny2017-05-141-1/+6
| | | | | | | | | | 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.
* Restore 5.minutes changed in #28204Andrew White2017-03-151-1/+1
|
* AS:Cache:MemoryStore doc fixes [ci skip] (#28389)Vipul A M2017-03-121-1/+1
|
* Merge pull request #27051 from devonestes/adding-cache-clear-docsVipul A M2017-03-121-0/+2
|\ | | | | Add missing documentation for MemoryStore#clear [ci skip]
| * Add missing documentation for MemoryStore#clear [ci skip]Devon Estes2016-11-151-0/+2
| | | | | | | | | | We were missing some form of documentation for this method, so I've gone ahead and added some!
* | Make sure local cache cleared even it's throwing:Lin Jen-Shin2017-03-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Deprecate implicit coercion of `ActiveSupport::Duration`Andrew White2017-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `ActiveSupport::Duration` implicitly converts to a seconds value when used in a calculation except for the explicit examples of addition and subtraction where the duration is the receiver, e.g: >> 2 * 1.day => 172800 This results in lots of confusion especially when using durations with dates because adding/subtracting a value from a date treats integers as a day and not a second, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 2 * 1.day => Mon, 10 Apr 2490 To fix this we're implementing `coerce` so that we can provide a deprecation warning with the intent of removing the implicit coercion in Rails 5.2, e.g: >> 2 * 1.day DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration to a Numeric is deprecated and will raise a TypeError in Rails 5.2. => 172800 In Rails 5.2 it will raise `TypeError`, e.g: >> 2 * 1.day TypeError: ActiveSupport::Duration can't be coerced into Integer This is the same behavior as with other types in Ruby, e.g: >> 2 * "foo" TypeError: String can't be coerced into Integer >> "foo" * 2 => "foofoo" As part of this deprecation add `*` and `/` methods to `AS::Duration` so that calculations that keep the duration as the receiver work correctly whether the final receiver is a `Date` or `Time`, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 1.day * 2 => Fri, 03 Mar 2017 Fixes #27457.
* | Privatize unneededly protected methods in Active SupportAkira Matsuda2016-12-245-28/+21
| |
* | No need to nodoc private methodsAkira Matsuda2016-12-241-1/+1
| |
* | Removes 'raw: true' from MemCacheStore#read_multi, per ↵Jonathan Hyman2016-11-161-1/+1
|/ | | | https://github.com/rails/rails/issues/27066.
* Remove deprecated set_cache_valueAndrew White2016-11-131-8/+0
|
* Remove deprecated escape_keyAndrew White2016-11-131-8/+0
|
* Remove deprecated key_file_pathAndrew White2016-11-131-8/+0
|
* Merge pull request #26536 from ↵Arthur Nogueira Neves2016-11-041-2/+2
|\ | | | | | | | | y-yagi/change_increment_and_decrement_to_public_api change `MemCacheStore#increment` and `MemCacheStore#decrement` to public API [ci skip]
| * change `MemCacheStore#increment` and `MemCacheStore#decrement` to public API ↵yuuji.yaginuma2016-09-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip] I'm not sure why these methods not public. But these methods are public in other cache stores, I think that may be in public. Ref: http://edgeapi.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-increment http://edgeapi.rubyonrails.org/classes/ActiveSupport/Cache/FileStore.html#method-i-increment http://edgeapi.rubyonrails.org/classes/ActiveSupport/Cache/MemoryStore.html#method-i-increment http://edgeapi.rubyonrails.org/classes/ActiveSupport/Cache/NullStore.html#method-i-increment
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-292-3/+3
| |
* | WhitespaceRafael Mendonça França2016-10-251-0/+1
|/
* Remove the word "mongrel" from documentsRyunosuke Sato2016-09-071-1/+1
| | | | | | | | | Currently mongrel is not maintained. And it couldn't be built with any Ruby versions that supported by Rails. It is reasonable to remove the word "mongrel" in order to avoid confusion from newcomer.
* Merge pull request #25628 from ysksn/optionsRafael Mendonça França2016-08-172-4/+4
|\ | | | | | | Remove parameter "options = nil" for #clear
| * Update CHANGELOG.md for #25628 [ci skip]Yosuke Kabuto2016-07-022-4/+4
| | | | | | | | | | | | Move new CHANGELOG entry top [ci skip] Remove parameter "options = nil" for #clear
* | Add three new rubocop rulesRafael Mendonça França2016-08-164-9/+9
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
| |
* | normalizes indentation and whitespace across the projectXavier Noria2016-08-061-14/+14
| |
* | modernizes hash syntax in activesupportXavier Noria2016-08-062-5/+5
| |
* | applies new string literal convention in activesupport/libXavier Noria2016-08-065-19/+19
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Pass over all Rails 5 warnings, to make sure:Vipul A M2016-04-121-1/+1
| | | | | | | | | | - we are ending sentences properly - fixing of space issues - fixed continuity issues in some sentences. Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 . This change reverts making sure we add '.' at end of deprecation sentences. This is to keep sentences within Rails itself consistent and with a '.' at the end.
* Revert "Instrument read_multi".Kasper Timm Hansen2016-02-201-9/+7
| | | | | | | | | | | | | | | | | | 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/+9
|\ | | | | Allow to store .keep file in cache directory
| * Allow to store .keep file in cache directoryAlexey Pokhozhaev2015-11-131-3/+9
| |
* | Merge pull request #22202 from grosser/grosser/write-consistentArthur Nogueira Neves2015-12-051-4/+4
|\ \ | | | | | | even if a write fails, store the raw value
| * | even if a write fails, store the raw valueMichael Grosser2015-11-291-4/+4
| | |
* | | Merge pull request #22361 from grosser/grosser/rescueArthur Nogueira Neves2015-11-301-26/+19
|\ \ \ | |/ / |/| | rescue memcached errors in a consistent way
| * | rescue memcached errors in a consistent wayMichael Grosser2015-11-291-26/+19
| | |
* | | add deprecations for a smooth transition after #22215Michael Grosser2015-11-193-3/+27
|/ /
* | keep deprecated namespaced_key in case any subclass uses itMichael Grosser2015-11-102-2/+2
| |
* | send normalized keys to the cache backends so they do not need to manage ↵Michael Grosser2015-11-103-25/+24
|/ | | | this themselves
* Merge pull request #22216 from grosser/grosser/fast-retRafael França2015-11-101-9/+12
|\ | | | | fast and consistent return when local_cache does not exist
| * fast and consistent return when local_cache does not existMichael Grosser2015-11-071-9/+12
| |
* | Merge pull request #22206 from grosser/grosser/drySantiago Pastorino2015-11-081-20/+15
|\ \ | |/ |/| dry up increment/decrement
| * dry up increment/decrementMichael Grosser2015-11-071-20/+15
| |
* | do not override fetch on local cacheMichael Grosser2015-11-071-9/+5
|/ | | | | | fetch is supposed to behave differently, this was a mistake merged in https://github.com/rails/rails/pull/22194
* Merge pull request #22193 from grosser/grosser/multiEileen M. Uchitelle2015-11-061-3/+3
|\ | | | | call local_cache 1 time instead of 3 times
| * call local_cache 1 time instead of 3 timesMichael Grosser2015-11-061-3/+3
| | | | | | | | | | LocalCache read_entry previously called the local_cache method 3 times, now it only calls it once and keeps the result in a local variable.
* | use prepend instead of extending every instanceMichael Grosser2015-11-063-30/+27
|/ | | | | extending an instance with a module puts the methods on top of it, prepend does the same but on the class level, so less work for us and more standard way of doing things
* Merge pull request #22194 from grosser/grosser/read-nilSean Griffin2015-11-051-3/+6
|\ | | | | 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-3/+6
| |
* | Merge pull request #19889 from cedrics/long-uri-encoded-keysSean Griffin2015-10-201-3/+4
|\ \ | |/ |/| 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-3/+4
| |
* | Merge pull request #20251 from davydovanton/doc-memory-storeRafael Mendonça França2015-05-212-2/+2
|\ \ | | | | | | Add nodoc label for protected Cache methods