php - Laravel cache::put returns false for large objects when using DB driver
When I use Laravel's database cache driver and when I insert relatively small strings and objects cache::put works fine and returns true. However when I attempt to enter larger objects it returns false.
I can't seem to find what the limit is, where to configure it or how to debug issues with it?
I've tried changing the database schema to a large text in case the DB insert was failing and I've looked through the src/illuminate/cache folder for anything helpful but with no luck. I also can't see anything helpful in the Laravel cache documentation.
This is how I'm calling it
Cache::put('test-'.time(), $identities, now()->addDays(30)))
Answer
Solution:
I don't fully understand what's happening but it was something to do with the encoding.
var_dump(Cache::put('1', mb_substr('Javier Fern??ndez-L??pez', 0, 20, 'UTF-8'), now()->addDays(30)));
var_dump(Cache::put('2', 'Javier Fern??ndez-L??pez', now()->addDays(30)));
var_dump(Cache::put('3', substr('Javier Fern??ndez-L??pez', 0, 20), now()->addDays(30)));
The above returns
TRUE
TRUE
FALSE
Substr was returning something a part of the caching didn't like
Source