Manol Posted April 4, 2016 Posted April 4, 2016 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.
Craig Posted April 4, 2016 Posted April 4, 2016 I would look at using the WireCache functionality. You can find more about that here: https://processwire.com/blog/posts/processwire-core-updates-2.5.28/ 5
Manol Posted April 4, 2016 Author Posted April 4, 2016 I would look at using the WireCache functionality. You can find more about that here: https://processwire.com/blog/posts/processwire-core-updates-2.5.28/ This is far more than I expected, awesome pw, thank you.
Manol Posted April 4, 2016 Author Posted April 4, 2016 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.
Macrura Posted April 4, 2016 Posted April 4, 2016 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(...)..
horst Posted April 5, 2016 Posted April 5, 2016 Do you use any sort of markup caching? TemplateCache, ProCache?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now