HEX
Server: LiteSpeed
System: Linux premium263.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: eastcjee (525)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //proc/thread-self/cwd/wp-content/plugins/wp-ultimate-review/app/updater/updater-cache.php
<?php


namespace WurReview\App\Updater;


trait Updater_Cache {

	public function get_cache( $cache_key ) {
		$cache = get_option( $cache_key );
		if ( ! $cache ) {
			return false;
		}

		if ( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
			return false; // Cache is expired
		}

		/**
		 *  We need to turn the icons into an array
		 */
		$cache['value'] = (object)json_decode( $cache['value'], true );

		if ( ! empty( $cache['value']->icons ) ) {
			$cache['value']->icons = (array) $cache['value']->icons;
		}

		return $cache['value'];
	}

	public function set_cache( $value, $cache_key) {

		$data = [
			'timeout' => strtotime( '+3 hours', time() ),
			'value'   => json_encode( $value ),
		];

		update_option( $cache_key, $data, 'no' );
	}

}