Skip to content

Fix CacheSequenceResolver for Redis with Compression & Serialization#14

Merged
inxilpro merged 2 commits intoglhd:mainfrom
rzv-me:patch-2
Mar 4, 2025
Merged

Fix CacheSequenceResolver for Redis with Compression & Serialization#14
inxilpro merged 2 commits intoglhd:mainfrom
rzv-me:patch-2

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