harishp's avatar

Test Cache in Laravel 8

How to test Cache::remember() without logger?

0 likes
12 replies
harishp's avatar

My dashboard still loading after implementing correct code of cache:remember(). Even laravel logger not showing exact testing result and displaying 0 quires in it!

Thank you for your help!

harishp's avatar

public static function getSearchTermsWithZeroResultsHome() {

    $search_term_zero_results_home = Cache::remember('search_term_zero_results_home', now()->addMinutes(60), function() {

...... .. });

    return $search_term_zero_results_home;
harishp's avatar

Yes, I do 'return TrackingSearchCriteria::where('results_count', 0) .... ); return $search_term_zero_results_home;

harishp's avatar

@tykus, is there any way other than Laravel logger to check loading timing changing after cache implementation or by clearing cache and load again site?

tykus's avatar

@harishp okay, it wasn't clear from the OP that you just wanted to see the change in execution time

Where do you want to see the result of the execution time?

harishp's avatar

@tykus Well, that's my question, is there any way to see the result of cache implementation? Well I am using react js to render the tasks and still it's showing me loading icons (even in milliseconds) after setting up cache:remember() for them! So, I am confuse that, is it react js loading function behavior and cache is working fine or it should not happen like that once cache setup work properly?

harishp's avatar

Or can we debug the load timing of that particular page in log files to see the changes of cache implementation?

Please or to participate in this conversation.