| | |
| | | |
| | | public function __construct() |
| | | { |
| | | $this->cache = Cache::for('videos')->connect('post'); |
| | | $this->vidData = Cache::for('vidData')->connect('post'); |
| | | if (JVB_TESTING) { |
| | | $this->cache->flush(); |
| | | $this->vidData->flush(); |
| | | } |
| | | $this->cache = Cache::for('videos', 'post'); |
| | | $this->vidData = Cache::for('vidData', 'post'); |
| | | } |
| | | public static function get(int $ID, array $args = []):string |
| | | { |
| | |
| | | public function formatVideo(int $ID, array $args = []):string |
| | | { |
| | | return $this->cache->remember( |
| | | $this->cache->generateKey(array_merge(['id' => $ID], $args)), |
| | | array_merge(['id' => $ID], $args), |
| | | function() use ($ID, $args) { |
| | | $url = wp_get_attachment_url($ID); |
| | | $meta = wp_get_attachment_metadata($ID); |
| | |
| | | |
| | | public function getImageData(int $imgID):array |
| | | { |
| | | return $this->imgData->remember( |
| | | return $this->vidData->remember( |
| | | $imgID, |
| | | function() use ($imgID) { |
| | | if (!wp_get_attachment_image($imgID, 'tiny')) { |