<?php

namespace WPML\LIB\WP;

use WPML\Collect\Support\Traits\Macroable;
use function WPML\FP\curryN;

class Transient {
	use Macroable;

	public static function init() {
		self::macro( 'get', curryN( 1, 'get_transient' ) );
		self::macro( 'getOr', curryN( 2, function ( $key, $default ) {
			return self::get( $key ) ?: $default;
		} ) );

		self::macro( 'set', curryN( 3, 'set_transient' ) );
		self::macro( 'delete', curryN( 1, 'delete_transient' ) );
	}

}

Transient::init();