APIAccelerator for WordPress

There is API functions that help to automate managing cache.

Functions#

Available functions:

OperateCache#

Manages cache (all pages or particular object).

Syntax#

OperateCache( $op = API::CACHE_OP_DEL, $obj = null )

Arguments#

  • $op

    Values:

    • CACHE_OP_REVALIDATE

      Revalidate cache.

    • CACHE_OP_CHECK_REVALIDATE

      Revalidate cache if needed.

    • CACHE_OP_CLEAR

      Cleanup old.

    • CACHE_OP_DEL

      Delete cache.

    • CACHE_OP_SRVDEL

      Delete server’s cache (if available).

  • $obj

    Site’s URLs or relative URIs each on new line or leave empty for site’s root. Also, revalidation expressions can be also used.

Example#

\seraph_accel\API::OperateCache( \seraph_accel\API::CACHE_OP_DEL, '/mypage/' );

GetCacheStatus#

Gets information about cache object by URL.

Syntax#

GetCacheStatus( $obj, $headers = array() )

Arguments#

  • $obj

    URL for checking.

  • $headers

    Optional array of HTTP headers. E,g, ‘User-Agent’ can be specified to check mobile page cache (see the sample below).

Return value#

Array with properties:

  • cache

    Values:

    • true

      Object cached.

    • false

      Object not cached.

  • optimization

    Values:

    • true

      Object is fully optimized.

    • false

      Object is not fully optimized (cache only).

    • null

      Object not cached.

  • status

    Values:

    • ‘done’

      Processing completed.

    • ‘revalidating’

      Processing is in progress.

    • ‘pending’

      Processing is in waiting state to be processed.

    • ‘none’

      Processing has not been performed.

  • dscFile

    Relative path of cache object descriptor file.

Example#

\seraph_accel\API::GetCacheStatus( 'https://mysite/mypage/', array( 'User-Agent' => 'AppleWebKit/9999999.99 Mobile' ) );

Leave a Reply