/**
* Write to Datastore
*
* @param $str_id
* @param $str_session_data
*/
private function persist($str_id, $str_session_data)
{
// syslog(LOG_WARNING, __METHOD__ . "() Writing to Datastore");
try {
$obj_store = $this->getStore();
$str_now = date('Y-m-d H:i:s');
if ($this->obj_session_entity instanceof Entity) {
$this->obj_session_entity->data = $str_session_data;
$this->obj_session_entity->updated = $str_now;
} else {
$this->obj_session_entity = $obj_store->createEntity(['data' => $str_session_data, 'created' => $str_now, 'updated' => $str_now]);
$this->obj_session_entity->setKeyName($str_id);
}
$obj_store->upsert($this->obj_session_entity);
} catch (\Exception $obj_ex) {
syslog(LOG_WARNING, __METHOD__ . "() Unable to write to Datastore: " . $obj_ex->getMessage());
}
}