Giter Site home page Giter Site logo

async-transients's People

Contributors

cmmarslender avatar jeffpaul avatar salcode avatar tlovett1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

async-transients's Issues

Typo in readme.md - to you are loading

Currently, readme.md says,

so make to you are loading your vendor/autoload.php file.

The word "to" appears to be a typo, perhaps "certain" instead.

"so make certain you are loading your vendor/autoload.php file."

readme updates

It's not obvious the level of support provided for this repo, so let's add some clarification.

  • add support level section and badge
  • add release version badge
  • add license file and badge

Not async

I've implemented this, but a new transient is not generated asynchronously, nor is the old transient returned when it has expired.

I've got a function that's supposed to return results, like so:

	$transientKey = "pis".$_POST["language"].$_POST["month"].$_POST["year"];

	$checkinNice = \TenUp\AsyncTransients\get_async_transient( $transientKey, 'get_month', array( $_POST["language"], $_POST["month"], $_POST["year"] ) );

	if(!$checkinNice) {
		$results = array();
	}
	else {
		$results = $checkinNice;
	}

Then, the 'get_month' function is like so:

function get_month($language, $month, $year) {
	global $wpdb;

	//Program items
	$date_start = date('Y-m-d H:i:s', mktime(0,0,0,$_POST["month"] - 1,1,$_POST["year"]));
	$date_end = date('Y-m-d H:i:s', -1 + mktime(0,0,0,$_POST["month"] + 2,1,$_POST["year"]));
	
	$args = array(...);

	$my_result = get_posts($args);

	\TenUp\AsyncTransients\set_async_transient( "pis".$language.$month.$year, $my_result, DAY_IN_SECONDS );	
}

This works, but when the transient has expired, the code takes as long to return results as without using async.

Question Regarding Transients and LITESPEEED CACHE

Describe your question

If my transient expires in 3 hours along with my page cache. How would I go about keeping the data fresh with Async ?

If the page cache is expired and the transient expires, its seems the data will always be 3 hours behind.

Is there a way I can add this process into a cache warming process and regenerate all of my soon to be expires transients than pre cache my pages with the new updated transients ?

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature Request] Update Locking

Is your enhancement related to a problem? Please describe.

This project is designed to update data "asynchronously", but the queue used does not persist across requests/threads, so if the callback is long-running enough, or the site has an even moderate amount of traffic, there's a good chance that the callback will be invoked more than once while the task is running.

This is a likely-enough scenario, that I feel like this functionality should be built in to the library. The cleanest path to this I can see is making the $queue property be backed a (normal, WP Core) transient, and have callbacks added/removed from the queue as they are completed.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.