get_transient(), PHP switch(), and comparison operators

Does it have to use a switch?

why not something like this:

if ( false === ( $value = get_transient( 'value' ) ) ) {
     // this code runs when there is no valid transient set
} else {
    // this code runs when there is a valid transient set
}

If the a transient returns a value it will not return true. It returns the value of the transient. If the transient is not set then it returns bool(false)

if you are using a switch it would be like this:

$transient = get_transient( foobar );

switch( $transient ) :

    case false:
        // transient not set
    break;

    default:
        // transient didnt return false
    break;

endswitch;