I’m having a bit of trouble with Memcached.
I have this code below:
if(!$Z->get('user')) {
$Z->set('user', $hs->load_hs_main($_GET['from'], $_GET['table']));
}
$je = $Z->get('user') ? $Z->get('user') : $hs->load_hs_main($_GET['from'], $_GET['table']);
What $Z->get('user') and $je are supposed to be is a MySQLi result object. This gives weird effects like print_r not functioning and it just doesn’t look right.
I want to check if an object exists that was created by memcached and use it if it exists.. but if it doesn’t, set it.
The correct way to get an item from cache or create/load it from somewhere else if it doesn’t exist is this: