Jump to content

$cache->renderFile doesn't cache properly when using timestamp for the expire parameter


Recommended Posts

$tomorrow1AM = strtotime("tomorrow 1:00");
echo cache()->renderFile("chunks/home/birthday.php", $tomorrow1AM); 

This code works fine if I use a WireCache constant for the expire parameter. 

But if I use a timestamp, as shown above, the cache doesn't work. 
The cached does get "created" (verified by looking in TracyDebugger) with an expire time of 1am the next day. 

However, the page is still loading 1700 pages of content, and taking 800ms to execute, as opposed to 53 pages of content and 90ms to execute when the cache is correctly getting used.

So it seems that $cache->renderFile is saving the cache, but not hitting it on future loads in my case. 

Do you have any insight? Any other information I need to share?

Link to comment
Share on other sites

Hard to say with this little information.

Try the following next debug steps:

  1. Use any other $expire value like 3600. Does it work correctly this way?
  2. Use any other file with the same $expire timestamp. Does this also produce the problem?
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
 Share

  • Recently Browsing   0 members

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