Jump to content

Recommended Posts

Posted

Is there a way to persist variables across different users without being logged and without writing the variable result to a file.

In my case the admin publishes several vehicles of different branches, these my differ every day so I've used LazyCron to check active branches every two hours, to avoid querying DB each time a user look for vehicles, I tried putting the result in a session variable but it doesn't work between different users.

 I could write the branches every two hours to a file and read it every time but, is there a better way to do it?

Thank you.

Posted

I'm using PW 2.6.1

$markas_cached = $cache->get("marcas", "+1 second", function($pages) {
            $markas = ["DAF", "IVECO", "LIEBHERR", "MAN", "MERCEDES", "RENAULT", "SCANIA", "SCHMITZ", "VOLVO"];
            return $markas;
}); 
echo json_encode($cache->get("marcas"));
echo json_encode($markas_cached);

I've changed array values manually $markas = ["DAF", "IVECO"] with different times with the template way but the array values never change. Any ideas.

Posted

are you caching a plain array or a Pagearray

Have you checked the database to see what is cached there in the caches table and what the expiration date is?

have you tried clearing the cache using $cache->delete(...)..

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...