Skip to content

Fix CacheSequenceResolver for Redis with Compression & Serialization #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

rzv-me
Copy link
Contributor

@rzv-me rzv-me commented Mar 4, 2025

Code is now compatible with Compression and Serialization enabled for Redis.

The implementation is the same as Laravel used for RateLimiting using Redis.

Had to recreate the logic as it is not available on Laravel < 11.x

src/Illuminate/Cache/RateLimiter.php

Without this change, I get this error when trying to create a snowflake ID:

InvalidArgumentException 

Sequences must be an integer between 0 and 4095 (got -1).

Code is now compatible with Compression and Serialization enabled for Redis. 

The implementation is the same as Laravel used for RateLimiting using Redis.

[src/Illuminate/Cache/RateLimiter.php](https://github.com/laravel/framework/blob/5d477f9a4080c1cdd43edd05ec4df61c738e0f8d/src/Illuminate/Cache/RateLimiter.php#L161)

Without this change, I get this error when trying to create a snowflake ID:
```
InvalidArgumentException 

Sequences must be an integer between 0 and 4095 (got -1).
```
@rzv-me
Copy link
Contributor Author

rzv-me commented Mar 4, 2025

cc: @inxilpro

@inxilpro inxilpro merged commit c2a0101 into glhd:main Mar 4, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants