Jump to content

cache()->preload() prevents items from being built?

Recommended Posts

Hi everyone,

I’ve come across this phenomenon where WireCache never builds cache entries if they were previously attempted to preload. Just wondering if anyone has any experience with preloading WireCache items? Am I doing something wrong?

I’ve described the issue here: https://github.com/processwire/processwire-issues/issues/1604

Here is the code I’m using:

cache()->preload([ 'imaginary', 'names' ]); //these don’t exist.

//now cache()->preloads is [ 'imaginary' => '', 'names' => '' ]

$freshlyGeneratedValue = cache()->get('imaginary', WireCache::expireDaily, function() {
    return 'so fresh'; //this never happens

var_dump($freshlyGeneratedValue); // string(0) ""


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...