# embed-privacy/1.11.2/inc/data/class-embed-cache.php

Embed Privacy, version 1.11.2. 44 lines.

- Page: https://pluginprobe.com/plugins/embed-privacy/1.11.2/code/inc/data/class-embed-cache.php
- Raw: https://pluginprobe.com/plugins/embed-privacy/1.11.2/raw/inc/data/class-embed-cache.php
- Modified: 2025-05-13T07:41:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/embed-privacy/1.11.2/code/inc/data/class-embed-cache.php#L10-L20`.

```php
<?php
namespace epiphyt\Embed_Privacy\data;

/**
 * Embed cache related functionality.
 * 
 * @author	Epiphyt
 * @license	GPL2
 * @package	epiphyt\Embed_Privacy
 * @since	1.11.0
 */
final class Embed_Cache {
	/**
	 * Get an embed cache entry.
	 * 
	 * @param	string	$url Embed URL
	 * @return	mixed Embed cache entry
	 */
	public static function get( $url ) {
		return \get_transient( self::get_key( $url ) );
	}
	
	/**
	 * Get an embed cache key.
	 * 
	 * @param	string	$url Embed URL
	 * @return	string Embed cache key
	 */
	public static function get_key( $url ) {
		return 'embed_privacy_embed_' . \md5( $url );
	}
	
	/**
	 * Set an embed cache entry.
	 * 
	 * @param	string	$url Embed URL
	 * @param	mixed	$data Data to cache
	 * @return	bool Whether the value was set
	 */
	public static function set( $url, $data ) {
		return \set_transient( self::get_key( $url ), $data, \WEEK_IN_SECONDS );
	}
}

```
