Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: New API Function #590

Closed
jaswrks opened this issue Oct 14, 2015 · 2 comments
Closed

Feature Request: New API Function #590

jaswrks opened this issue Oct 14, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@jaswrks
Copy link

@jaswrks jaswrks commented Oct 14, 2015

I'd like to request a new API Function in ZenCache that would allow a site owner to clear the cache for a specific URL. We recently added one that allows you to clear a specific post ID, but it would be easier for most people if this could be extended to allow for a specific URL that they provide.

API Functions That Exist Already

<?php
require_once dirname(__FILE__).'/wp-load.php';

zencache::version();
zencache::options();
zencache::clear();
zencache::wipe();
zencache::purge();
zencache::clearPost($post_id);
zencache::clearUser($user_id);
zencache::clearCurrentUser();

What I'd like to add...

zencache::clearUrl($url);

Next Actions

  • New feature branch in the websharks/zencache-pro repo.

  • After this line add a new method:

    /**
    * This clears the cache for a specific URL.
    *
    * @since 15xxxx Adding support for custom URLs.
    *
    * @param string $url Input URL to clear.
    *
    * @return int Total files cleared (if any).
    */
    public static function clearUrl($url)
    {
        $regex = $GLOBALS[GLOBAL_NS]->buildHostCachePathRegex($url);
        return $GLOBALS[GLOBAL_NS]->clearFilesFromHostCacheDir($regex);
    }
  • Submit PR.

@raamdev
Copy link
Contributor

@raamdev raamdev commented Oct 16, 2015

Next Pro Release Changelog:

  • Enhancement: Added a new API Function that allows a site owner to clear the cache for a specific URL via zencache::clearUrl($url);. See this article for further details. Props @kristineds. See Issue #590.
@raamdev
Copy link
Contributor

@raamdev raamdev commented Nov 14, 2015

ZenCache v151114 has been released and includes changes from this GitHub Issue. See the v151114 announcement for further details.


This issue will now be locked to further updates. If you have something to add related to this GitHub Issue, please open a new GitHub Issue and reference this one (#590).

@wpsharks wpsharks locked and limited conversation to collaborators Nov 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants