LLMS_Abstract_Session_Database_Handler::save( int $expires )
Save the session to the database
Parameters Parameters
- $expires
-
(int) (Required) Timestamp of the session expiration.
Return Return
(boolean)
Source Source
File: includes/abstracts/llms-abstract-session-database-handler.php
public function save( $expires ) {
// Only save if we have data to save.
if ( $this->is_clean ) {
return false;
}
global $wpdb;
$save = $wpdb->query( // phpcs:ignore: WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
$wpdb->prepare(
"INSERT INTO {$wpdb->prefix}lifterlms_sessions ( `session_key`, `data`, `expires` ) VALUES ( %s, %s, %d )
ON DUPLICATE KEY UPDATE `data` = VALUES ( `data` ), `expires` = VALUES ( `expires` )",
$this->get_id(),
maybe_serialize( $this->data ),
$expires
)
);
wp_cache_set( $this->get_cache_key( $this->get_id() ), $this->data, $this->cache_group, $expires - time() );
$this->is_clean = true;
return (bool) $save;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |