| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
- Moving the `supports_cache_versioning?` check to a class method.
- Shorten the method doc.
- Expand on the error message.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Firstly, increment and decrement shouldn't care about the particulars of
key expiry. They should only know that they have to pass that responsibility
on to somewhere else.
Secondly, it moves the key normalization back inside the instrumentation like
it was originally. I think that matches the original design intention or at
the very least it lets users catch haywire key truncation.
Thirdly, it moves the changelog entry to the top of the file, where new entries
go. I couldn't understand what the entry was saying so I tried to rewrite it.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #32610. Closes #32614.
Lua scripts in redis are *blocking*, meaning that no other client can
execute any commands while the script is running. See
https://redis.io/commands/eval#atomicity-of-scripts.
This results in the following exceptions once the number of keys is
sufficiently large:
BUSY Redis is busy running a script.
You can only call SCRIPT KILL or SHUTDOWN NOSAVE.
This commit replaces the lua-based implementation with one that uses
`SCAN` and `DEL` in batches. This doesn't block the server.
The primary limitation of `SCAN`, i.e. potential duplicate keys, is of
no consequence here, because `DEL` ignores keys that do not exist.
|
|
|
|
|
|
|
|
|
|
| |
Namespace not working in RedisCacheStore#clear method. Bacause
namespace = merged_options(options)[namespace]
is always nil, Correct is
namespace = merged_options(options)[:namespace]
|
|
|
|
| |
It should returns raw value, not instance of `ActiveSupport::Cache::Entry`.
|
| |
|
|
|
|
|
|
|
|
| |
Since `Redis#call` duck types as a Proc, we'd call `#call` on it,
thinking it's a Proc. Fixed by check for the Proc explicitly instead of
duck typing on `#call`.
References #32233
|
|
|
|
|
| |
Fixes #31909.
Closes #31911.
|
|
|
|
|
|
| |
Skipping over 2.4.0 to sidestep the `"symbol_from_string".to_sym.dup` bug.
References #32028
|
|\
| |
| |
| | |
Add support for connection pooling on RedisCacheStore
|
| | |
|
| |
| |
| |
| |
| |
| | |
[ci skip]
Closes #31967
|
| | |
|
| | |
|
| |
| |
| |
| | |
Use `serialize_entry` throughout and introduce `serialize_entries`.
|
|/
|
|
|
| |
Closes #31886
Fixes #31884
|
|
|
|
|
| |
This reverts commit ac74e2c521f6ddc0eac02d74a1313261bcc1d60f, reversing
changes made to ffdb06136152b3c5f7f4a93ca5928e16e755d228.
|
| |
|
| |
|
| |
|
|
|
|
| |
Fix encoding errors when using the pure-Ruby Redis driver instead of Hiredis. Dodge incompatibilities between UTF-8 and arbitrary value encodings, which rear their heads when the Redis driver tries to build a single command string from incompatibly-encoded keys and values.
|
|
|
|
| |
Update the long key handling test so it triggers truncation in the Redis cache store.
|
|
|
|
| |
currently it's not possible to know what the hit rates are from read_multi
|
|
|
|
|
|
|
|
|
| |
* The `DEFAULT_ERROR_HANDLER` constant in
`ActiveSupport::Cache::RedisCacheStore` contained references
to an undefined argument `e`, which is supposed to refer
to the `exception` parameter.
* Update the default error handler proc to correctly reference
the `exception` parameter.
|
|
|
|
|
|
|
|
| |
implementation
and defaults to `Digest::MD5`.
Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
| |
Support `expires_in` in `ActiveSupport::Cache::MemCacheStore#increment`
and `#decrement`.
Closes #30716.
|
|
|
|
| |
`keys_to_names` is used only for `keys_to_names.keys`.
|
|
|
|
| |
Ref: https://travis-ci.org/rails/rails/jobs/303840778#L1974
|
|
|
|
|
|
|
|
|
|
|
| |
* Supports vanilla Redis, hiredis, and Redis::Distributed.
* Supports Memcached-like sharding across Redises with Redis::Distributed.
* Fault tolerant. If the Redis server is unavailable, no exceptions are
raised. Cache fetches are treated as misses and writes are dropped.
* Local cache. Hot in-memory primary cache within block/middleware scope.
* `read_/write_multi` support for Redis mget/mset. Use Redis::Distributed
4.0.1+ for distributed mget support.
* `delete_matched` support for Redis KEYS globs.
|
|
|
|
| |
This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
|
|
|
|
| |
cleaning up the expired cache keys
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
No need to pass `#cleanup` options through to `LocalCache#clear`.
Fixes #29081. References #25628.
|
|
|
|
|
|
|
|
|
| |
See https://github.com/rails/rails/issues/29067#issuecomment-301342084
for rationale.
This reverts commit b76f82d714e590c20370e72fa36fa574c4f17650.
Fixes #29067. Fixes #29081.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|\
| |
| | |
Add missing documentation for MemoryStore#clear [ci skip]
|
| |
| |
| |
| |
| | |
We were missing some form of documentation for this method, so I've gone ahead
and added some!
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|