Cleas the cache of a specific post id
@param  integer $postId Post id to clear
@return boolean
92
public static function clearCache($postId, $post)
    {
        if (wp_is_post_revision($postId) || get_post_status($postId) != 'publish') {
            return false;
        }

        wp_cache_delete($postId, self::getKeyGroup());
        wp_cache_delete($post->post_type, self::getKeyGroup());

        // Empty post type for all sites in network (?)
        if (function_exists('is_multisite') && is_multisite() && apply_filters('Municipio\Cache\EmptyForAllBlogs', false, $post)) {
            $blogs = get_sites();

            foreach ($blogs as $blog) {
                wp_cache_delete($post->post_type, self::getKeyGroup($blog->blog_id));
            }
        }

        return true;
    }
331459
public function fetch( $id ) {

		if ( $this->contains( $id ) ) {
			$this->cacheHits++;
			return $this->moveToMostRecentlyUsedPosition( $id );
		}

		$this->cacheMisses++;
		return false;
	}
338756
public function findCacheById(int $id, int $siteId = null)
    {

        // Resolve siteId
        $siteId = SiteHelper::resolveSiteId($siteId);

        // Check if already in addToCache
        if ($this->isCachedById($id, $siteId)) {
            return $this->cacheById[$siteId][$id];
        }

        return null;
    }
795882
public function delete($blogId, $postId, $optParams = array()) {
      $params = array('blogId' => $blogId, 'postId' => $postId);
      $params = array_merge($params, $optParams);
      $data = $this->__call('delete', array($params));
      return $data;
    }
931392
public function delete(Post $post)
    {
        $response = $this->api->process(new DeletePost($post));
        if ($response->getStatusCode() == 200) {
            return true;
        } else {
            return false;
        }
    }
476535
public function hasItem($cacheId)
    {
        $cacheId = $this->normalizeKey($cacheId);

        try {
            return $this->cache->hasItem($cacheId);
        } catch (ZendException\ExceptionInterface $ex) {
            return false;
        }
    }
170640
public function getLastVersion($post_id)
	{
		$qb = $this->createQueryBuilder('p');
		
		$qb->where('p.original=:post_id')
			->orderBy('p.createdAt', 'DESC')
			->setParameter(':post_id', $post_id);
		
		$result = $qb->getQuery()->setMaxResults(1)->getResult(Query::HYDRATE_OBJECT);
		
		if ( is_null($result) ) {
			$qb2 = $this->createQueryBuilder('p');
			$qb2->where('p.id=:post_id')->setParameter(':post_id', $post_id);
			
			$result = $qb->getQuery()->getResult(Query::HYDRATE_OBJECT);
		}
		
		return $result;
	}
290335
private function getCache($cacheID)
    {
        if ($this->appCache->contains($cacheID)) {
            return unserialize($this->appCache->fetch($cacheID));
        }

        return false;
    }
605753
public function deletePost($post_id)
	{
		$token = $this->oauth->getToken();

		// Set parameters.
		$parameters = array(
			'oauth_token' => $token['key']
		);

		// Set the success response code.
		$this->oauth->setOption('success_code', 204);

		// Set the API base
		$base = '/v1/posts/' . $post_id;

		// Build the request path.
		$path = $this->getOption('api.url') . $base;

		// Send the request.
		$response = $this->oauth->oauthRequest($path, 'DELETE', $parameters);

		return $response;
	}
521875
public function clearByPageId(int $pageId)
    {
        $cache = $this->get();
        $cacheEntries = \array_keys($cache->getByTag('pageId_' . $pageId));
        foreach ($cacheEntries as $cacheEntry) {
            $cache->remove($cacheEntry);
        }
    }
34570
public function unset($post_id, string $key)
    {
        $post_id = (int) ($post_id ?? get_the_ID());

        if (!$post_id || !$key) {
            return; // Not possible.
        }
        delete_post_meta($post_id, $this->key($key));
    }
189166
public function regenerateFile($postId) {
	    @set_time_limit(120);

	    $fullsizepath = get_attached_file( $postId );
	    if (!file_exists($fullsizepath)) {
	        if (function_exists('_load_image_to_edit_path')) {
                $fullsizepath = _load_image_to_edit_path($postId);
            } else {
	            Logger::warning("The function '_load_image_to_edit_path' does not exist, using internal implementation.");
	            $fullsizepath = $this->loadImageToEditPath($postId);
                Logger::warning("$postId => $fullsizepath");
            }
	    }

	    if (!file_exists($fullsizepath)) {
		    if (strpos($fullsizepath, 'http') === 0) {
			    $path = parse_url($fullsizepath, PHP_URL_PATH);
			    $pathParts = explode('/', $path);
			    $file = array_pop($pathParts);

			    $uploadDirInfo = wp_upload_dir();

			    $filepath = $uploadDirInfo['path'].'/'.$file;
			    Logger::startTiming("Downloading fullsize '$fullsizepath' to '$filepath'");
			    file_put_contents($filepath, file_get_contents($fullsizepath));
			    Logger::endTiming("Finished downloading fullsize '$fullsizepath' to '$filepath'");

			    if (!file_exists($filepath)) {
			        return "File '$fullsizepath' could not be downloaded.";
                }

			    $fullsizepath = $filepath;
		    } else {
		        return "Local file '$fullsizepath' does not exist and is not a URL.";
		    }
	    }

	    Logger::startTiming('Regenerating metadata ...', ['id' => $postId]);
	    $metadata = wp_generate_attachment_metadata( $postId, $fullsizepath );
	    Logger::endTiming('Regenerating metadata ...', ['id' => $postId]);

	    wp_update_attachment_metadata($postId, $metadata);

	    return true;
    }
774694
public function delete( $id ) {

		if ( $this->contains( $id ) ) {
			$this->count--;
			$this->cacheDeletes++;
			unset( $this->cache[ $id ] );
			unset( $this->ttl[ $id ] );
			return true;
		}

		return false;
	}
820521
public function removePostFromFavorite($post_id)
    {
        $this->checkId($post_id);

        return $this->adapter->delete(sprintf('/post/%d/favorite', $post_id));
    }
479631
public function delete( $post_id, $key, $meta_value = '' ) {
		if ( $post_id <= 0 ) {
			return false;
		}

		return delete_post_meta( $post_id, $this->get_meta_key( $key ), $meta_value );
	}
58605
public function getDeliveryThemeIdFromCache($deliveryId)
    {
        if ($this->getCachePersistence() === null) {
            return false;
        }

        return $this->getCachePersistence()->get($this->getCacheKey($deliveryId));
    }
190618
public function deleteOembedCaches( $post_id = 0 ) {
		if ( $post_id ) {
			global $wp_embed;
			$wp_embed->delete_oembed_caches( $post_id );
		} else {
			global $wpdb;
			$post_metas = $wpdb->get_results( "SELECT post_id, meta_key FROM {$wpdb->postmeta} WHERE meta_key LIKE '_oembed_%' " );
			foreach ( $post_metas as $post_meta ) {
				delete_post_meta( $post_meta->post_id, $post_meta->meta_key );
			}
		}
	}