first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
class WPML_WP_Cache_Item {
/** @var string $key */
private $key;
/** @var WPML_WP_Cache $cache */
private $cache;
/**
* WPML_WP_Cache_Item constructor.
*
* @param WPML_WP_Cache $cache
* @param string|array $key
*/
public function __construct( WPML_WP_Cache $cache, $key ) {
if ( is_array( $key ) ) {
$key = md5( json_encode( $key ) );
}
$this->cache = $cache;
$this->key = $key;
}
/**
* @return bool
*/
public function exists() {
$found = false;
$this->cache->get( $this->key, $found );
return $found;
}
/**
* @return mixed
*/
public function get() {
$found = false;
return $this->cache->get( $this->key, $found );
}
/**
* @param mixed $value
*/
public function set( $value ) {
$this->cache->set( $this->key, $value );
}
}