aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/cache/file_store.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.
* Use Dir#children and Dir#each_child instead of excluding "." and ".."Ricardo Díaz2019-02-131-10/+3
| | | | | | | | Both methods were introduced in Ruby 2.5 and fit this use case very nicely: listing a directory's entries excluding the "." and ".." nodes. The private method #exclude_from was removed as it no longer serves its original purpose.
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-6/+4
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Switch to supports_cache_versioning? check to a class methodschneems2018-09-201-4/+2
| | | | | - Moving the `supports_cache_versioning?` check to a class method. - Shorten the method doc. - Expand on the error message.
* [close #33907] Error when using "recyclable" cache keys with a store that ↵schneems2018-09-201-0/+7
| | | | | | | | | | | | | | does not support it If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate. This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via ``` config.active_record.cache_versioning = true ``` Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method `supports_in_cache_versioning?` and returning true.
* Faster File Storeschneems2018-09-061-6/+10
| | | | | | Memory before 1826584.8 memory after: 1797795.6 difference: 1.58% memory (speed) savings. When the key is not longer than the limit we can avoid allocating two strings and an array.
* Introduced `ActiveSupport::Digest` that allows to specify hash function ↵Dmitri Dolguikh2017-12-121-1/+1
| | | | | | | | implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
* [Active Support] require_relative => requireAkira Matsuda2017-10-211-3/+3
| | | | This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
* Fixes ActiveSupport::Cache::FileStore#cleanup bug which prevented it from ↵Erich Soares Machado2017-10-031-3/+2
| | | | cleaning up the expired cache keys
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* [Active Support] require => require_relativeAkira Matsuda2017-07-011-3/+3
|
* Revert #25628. Incomplete change + needs a deprecation cycle.Jeremy Daer2017-06-101-1/+1
| | | | | | | | | See https://github.com/rails/rails/issues/29067#issuecomment-301342084 for rationale. This reverts commit b76f82d714e590c20370e72fa36fa574c4f17650. Fixes #29067. Fixes #29081.
* Privatize unneededly protected methods in Active SupportAkira Matsuda2016-12-241-2/+1
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-1/+1
|
* Remove deprecated key_file_pathAndrew White2016-11-131-8/+0
|
* Merge pull request #25628 from ysksn/optionsRafael Mendonça França2016-08-171-1/+1
|\ | | | | | | Remove parameter "options = nil" for #clear
| * Update CHANGELOG.md for #25628 [ci skip]Yosuke Kabuto2016-07-021-1/+1
| | | | | | | | | | | | Move new CHANGELOG entry top [ci skip] Remove parameter "options = nil" for #clear
* | Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | | | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* | applies new string literal convention in activesupport/libXavier Noria2016-08-061-7/+7
|/ | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* 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
| |
* | add deprecations for a smooth transition after #22215Michael Grosser2015-11-191-0/+8
| |
* | keep deprecated namespaced_key in case any subclass uses itMichael Grosser2015-11-101-1/+1
| |
* | send normalized keys to the cache backends so they do not need to manage ↵Michael Grosser2015-11-101-15/+13
|/ | | | this themselves
* use prepend instead of extending every instanceMichael Grosser2015-11-061-1/+1
| | | | | 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
* when checking for too long cache keys used the uri encoded fname Cedric Sohrauer2015-04-241-3/+4
|
* Allow AS::Cache::FileStore#clear without cache directoryKohei Suzuki2015-04-091-0/+1
| | | | | | 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.
* fix error with long keys in ActiveSupport::Cache::FileStoreAdam Panzer2014-06-101-0/+5
|
* Copy-edit the parent commitRafael Mendonça França2013-12-121-6/+8
|
* Merge pull request #13268 from aayushkhandelwal11/masterRafael Mendonça França2013-12-121-22/+16
|\ | | | | | | Moving the common code of increment and decrement of cache file store in...
| * Moving the common code of increment and decrement of cache file store into ↵Aayush khandelwal2013-12-121-22/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | seprate function Removing the double checking for the value of id simplifying code for checking conditional code for key Removing the default values for parameters removing reduntant code and asiigning value of id in local variable removing wrongly added line break[ci ckip] reverting code
* | typo rectified [skip ci]Aayush khandelwal2013-12-111-1/+1
|/
* Merge pull request #11785 from grosser/grosser/file-unless-existRafael Mendonça França2013-10-281-0/+1
|\ | | | | | | | | | | | | | | support :unless_exist for FileCache Conflicts: activesupport/CHANGELOG.md activesupport/test/caching_test.rb
| * support :unless_exist for FileCachegrosser2013-08-301-0/+1
| |
* | Fix FileStore#cleanup to no longer rely on missing each_key methodMurray Steele2013-09-111-1/+2
|/
* Add documentation for FileStore#increment and #decrementMatt Stopa2013-07-101-0/+4
| | | | [ci skip]
* Add documentation for #clear on certain Store classesMatt Stopa2013-07-101-0/+1
| | | | [ci skip
* Update the filestore documentation for clearMatt Stopa2013-07-091-0/+3
| | | | [ci skip]
* Fix deletion of empty directories:Charles Jones2013-02-251-2/+2
| | | | | | | | | | | | | | | 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.
* Patched Marshal#load to work with constant autoloading ↵Uriel Katz2012-12-011-0/+1
| | | | (active_support/dependecies.rb) (issue #8167)
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-4/+3
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* Merge pull request #5125 from winston/log_exception_when_cache_read_failsMichael Koziarski2012-05-211-1/+2
|\ | | | | #read_entry in ActiveSupport::Cache::FileStore should log details of the exception when an exception is thrown
| * #read_entry in ActiveSupport::Cache::FileStore should log details of the ↵Winston2012-02-221-1/+2
| | | | | | | | exception when an exception is thrown.
* | Remove wrong rack/utils dependency from ASSantiago Pastorino2012-05-121-3/+3
| | | | | | | | Closes #6274
* | Merge pull request #4452 from tapajos/e5425c8f68fbb720fcbf4b14e1f154ac27dbbbedAaron Patterson2012-05-031-1/+1
|\ \ | | | | | | Fix cache (FileStore) clear to keep .gitkeep.
| * | Cache (FileStore) clear should keep .gitkeepMarcos Tapajos2012-01-131-1/+1
| | |
* | | Merge pull request #4911 from Floppy/masterAaron Patterson2012-03-301-1/+1
|\ \ \ | |_|/ |/| | Reduce FILENAME_MAX_SIZE in ActiveSupport::Cache::FileStore
| * | Change FILENAME_MAX_SIZE in FileStore to 228.James Smith2012-02-061-1/+1
| |/ | | | | | | In order that temp filenames generated from it will fit in 255 chars. See https://github.com/rails/rails/issues/4907
* / Bug: cache_path.size doesn't return length of filename but size of file if ↵Issei Naruta2012-02-211-1/+1
|/ | | | cache_path is Pathname.