Session::set( string $key, mixed|null $val = null )

Description #

Set offset in AnsPress session.

Parameters #

  • $key
    string (Required) Offset key.
  • $val
    mixed | null (Optional) Offset value. Delete key value pair if this is null. Default value: null

Changelog #

VersionDescription
4.1.5Introduced.

Source #

File: includes/class/class-session.php

	public function set( $key, $val = null ) {
		$cache = get_transient( 'anspress_session_' . $this->id );

		if ( false === $cache ) {
			$cache = array( $key => $val );
		}

		$cache[ $key ] = $val;

		set_transient( 'anspress_session_' . $this->id, $cache, $this->expires );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment