Undefined cache functions in my custom plugin


I am making a plugin that make a HTTP call to my API, I want this call be cached an tried using this way:

static function get_info(){
    $cache = wp_cache_get( $username, "action" );
        $cache = file_get_contents(...);
        wp_cache_set( $username, $cache, "action", 900 );
    return $cache;

When I run this code (this php file are inside my plugin) I am getting

“Fatal error: Uncaught Error: Call to undefined function

I have to maque a require from wp-includes.php cache file? Or maybe I am missing something.

user1422434 4 months 0 Answers 14 views 0

Leave an answer