Support the ongoing development of Laravel.io →
posted 10 years ago
Cache

Hi,

I'm trying to get Cache working, but whenever I call to any of its methods as described in docs (get, put, has,..) I get an error:

Call to undefined method Illuminate\Support\Facades\Cache::has()

My code is:

Route::get('/test', function(){
    
    if (Cache::has('somedata'))
    {
        $somedatas = Cache::get('somedata');
    }
    else
    {
        $somedatas = Somedata::all();
        Cache::add('somedata', $somedatas, 525949); // for a year
    }

    ...
});
Last updated 3 years ago.
0

What version of laravel are you using?

Last updated 3 years ago.
0

What version of laravel are you using?

Last updated 3 years ago.
0

I have 4.2.8

Last updated 3 years ago.
0

UPDATE: when trying to make

$users = User::with('prop')->remember(10)->get();

I also get an error:

Class cache does not exist

and when trying to create cache instance by

$c = new Cache;

I get

Call to undefined method Illuminate\Support\Facades\Cache::driver()

I would appreciate any help.

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

griffonn griffonn Joined 27 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.