Download the PHP package 10up/async-transients without Composer

On this page you can find all versions of the php package 10up/async-transients. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package async-transients

Async Transients

Transients that serve stale data while regenerating the new transients in the background.

Background & Purpose

Transients are great for storing data that is expensive to regenerate, but we still run in to the problem of needing to regenerate that data synchronously once the transient expires. This library solves that problem by serving stale data once the transient is expired, and processing the regenerate callback after the request has finished, so that end users never see the impact of regenerating transients.

Requirements

Requires support for fastcgi_finish_request, or else transients will regenerate expired data immediately.

Installation

This library is meant to be included with composer. To install, run composer require 10up/async-transients. The library is set up to use composer's autoloader, so make certain you are loading your vendor/autoload.php file.

Usage

Usage is similar to standard WordPress transient functions, in that you provide a transient key and an expiration time, but its different in that you must also provide a callback function, as well as any (optional) parameters to pass to the callback function, that should be called to regenerate the transient data if it is expired.

Example Usage:

How does all of this work?

First, when calling get_async_transient, you now have to pass a callback function, and optionally, any parameters to pass to the callback function. The transient is then retrieved, much like how WordPress core would retrieve it, but with a key difference. Instead of returning nothing if the transient is expired, we return the last known value, and add the callback function and params to a queue, to process later. By the end of the request, we have a queue of that contains callback functions for all transients that were accessed, that had expired data.

Next, we hook into the WordPress shutdown action. The shutdown action runs just before PHP shuts down execution. The Transient class hooks into that action, and calls the fastcgi_finish_request function, if it is available. That function flushes all response data to the client, and as far as the browser is concerned, the request is done, however, php is allowed to keep running in the background.

At this point, we iterate over all the callback functions in the queue, which then regenerate any transient data that was accessed, but was expired.

Issues

If you identify any errors or have an idea for improving the plugin, please open an issue. We're excited to see what the community thinks of this project, and we would love your input!

Support Level

Stable: 10up is not planning to develop any new features for this, but will still respond to bug reports and security concerns. We welcome PRs, but any that include new features should be small and easy to integrate and should not include breaking changes. We otherwise intend to keep this tested up to the most recent version of WordPress.

Like what you see?


All versions of async-transients with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package 10up/async-transients contains the following files

Loading the files please wait ....