vetruvet / laravel-phpredis

Use phpredis as the redis connection in Laravel
Apache License 2.0
43 stars 9 forks source link

Getting Unnecessary error when using Redis as Cache Driver in laravel 5.2 #7

Open masterpowers opened 8 years ago

masterpowers commented 8 years ago

I got a provisioned server in forge and local im using phpredis branch php7 then added your package... everything is working fine using the facade

$redis = PHPRedis::connection();
$redis->set('key', 'value');
return $redis->get('key');

even as Pub/Sub works great...

But Majority that is Out of the Box from laravel

i believe there is also an issue in laravel 4.2...

that the cache driver is not being recognize properly...

I tried to install it in 5.2 then run php artisan make:auth

which uses ThrottleLogin Trait, which uses RateLimiter Class ,

that uses CacheRepository...

Even if i Login correctly im can get an error.

Too many login attempts. Please try again in -1458033818 seconds.

The problem occurs when the has method is being called...

$this->hasTooManyLoginAttempts($request)

if i dive into this it is calling this piece of code

if ($this->cache->has($key.':lockout')) {
            return true;
        }

and is returning false.... instead of null so it triggers the method that is it true... so when this method is called

public function availableIn($key)
    {
        return $this->cache->get($key.':lockout') - time();
    }

literally the get has nothing to get causing -negative time...

I hope you can fix this bug thanks

masterpowers commented 8 years ago

The only thing i did to fix this is use predis/predis package then still use your package, but i dont know if im still using the phpredis .. cause it is already installed in my system cause when i try to use php artisan tinker im getting Predis\Client Object .... Im not getting a bool value of true... which is the default before when using the facade with only your package... please check on this, you got a really good package...

it-can commented 8 years ago

I have the same error "Too many login attempts. Please try again in -1458033818 seconds." when using this package...

it-can commented 8 years ago

I am using https://github.com/tillkruss/laravel-phpredis now, seems to work correctly with cache also