Automattic\WooCommerce\StoreApi

SessionHandler::save_data()publicWC 1.0

Save data and delete user session.

Method of the class: SessionHandler{}

No Hooks.

Return

null. Nothing (null).

Usage

$SessionHandler = new SessionHandler();
$SessionHandler->save_data();

SessionHandler::save_data() code WC 9.4.2

public function save_data() {
	// Dirty if something changed - prevents saving nothing new.
	if ( $this->_dirty ) {
		global $wpdb;

		$wpdb->query(
			$wpdb->prepare(
				"INSERT INTO $this->table (`session_key`, `session_value`, `session_expiry`) VALUES (%s, %s, %d) ON DUPLICATE KEY UPDATE `session_value` = VALUES(`session_value`), `session_expiry` = VALUES(`session_expiry`)", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
				$this->_customer_id,
				maybe_serialize( $this->_data ),
				$this->session_expiration
			)
		);

		$this->_dirty = false;
	}
}