Caching in Database
mattwells opened this issue · 5 comments
Caching the bad passwords list in the default Laravel migration for the cache table using MySQL (text with maximum length of 65k characters) is to big and crops the end of list which causes a decryption error "The payload is invalid." next time someone tries to change their password.
The default Laravel Database Migration is as follows:
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->unique();
$table->text('value');
$table->integer('expiration');
});
In MySQL a text
column has a maximum length of 65,535 characters (third paragraph). The length of the cached badpassword.txt
in the cache table is 371,428 characters. This means that the end of the list gets cropped when it is being stored which becomes corrupted.
Oh @mattwells I totally get what you mean.
Can you use another cache driver rather than the database driver e.g Redis or Memcached ? I never tested this with the database cache driver.
hi @unicodeveloper for now I have changed the value
column to a mediumtext
which has solved the issue. I do hope to move across to a dedicated cache solution in the future though.
Thanks, @mattwells. I think I can close this issue now!