laravel / pennant

A simple, lightweight library for managing feature flags.
https://laravel.com/docs/pennant
MIT License
474 stars 48 forks source link

Add Redis Driver #77

Closed gabrielmoura closed 9 months ago

gabrielmoura commented 9 months ago

Considering the necessity of employing storage other than arrays or databases, I took the liberty of crafting a driver to provide native support for Redis.

The advantage lies in not being confined to a single Laravel instance or the database, which already contends with its challenges of overload.

This minor alteration is a replica of the database driver, with adaptations for writing and reading Hash in Redis.

taylorotwell commented 9 months ago

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If possible, please consider releasing your code as a package so that the community can still take advantage of your contributions!

If you feel absolutely certain that this code corrects a bug in the framework, please "@" mention me in a follow-up comment with further explanation so that GitHub will send me a notification of your response.

potsky commented 4 months ago

thank you @gabrielmoura for your PR.

For me Redis is a must have :

  1. Array driver does not work on multi-server infrastructure
  2. Database driver does not work at scale, we have thousand of SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "features_name_scope_unique" because of the driver architecture when you have thousand requests per seconds

@taylorotwell could you consider this PR?

timacdonald commented 4 months ago

@potsky, can you please open an issue about the unique violations and we can look into it. The DB driver likely needs to perform upserts.